- Screen name: stevenhus
stevenhus's Profile
31 Posts
68 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 11-Mar-2013 01:51 PM
- Forum: Using jQuery Plugins
This accordion works fine when it's on the page by itself, but when I dynamically populate the individual title/content pairs via a web database, the title and content are both visible fo rall entries instead of just the title, so the accordion function ceases to work. Is there a problem with the way I implemented it, or do they simply quit working when innerHTML is involved?The rest of the database (inserting dictionary term and definition in 2 different fields) is functioning flawlessly without the accordion function. I want to integrate the accordion so there's less scrolling for the user.Here is the code implemented and the code (commented out) straight from the source for comparison:- function showRecords() {
- results.innerHTML = '';
- results.innerHTML = '<div id="accordion">';
- db.transaction(function(tx) {
- tx.executeSql(selectAllStatement, [], function(tx, result) {
- dataset = result.rows;
- for (var i = 0, item = null; i < dataset.length; i++) {
- item = dataset.item(i);
- results.innerHTML +=
- '<h3>' + item['term'] + '</h3><div><p>' + item['definition'] + '<button
- class="glossaryButton2" onClick="loadRecord('+i+')">Edit</button> ' +
- '<button class="glossaryButtonDel" style="float:right;"
- onClick="deleteRecord('+item['id']+')">Delete</button></p><hr></div>';
- }
- });
- }); results.innerHTML += '<div id="accordion">';
- }
- /*
- <div id="accordion">
- <h3>Section 1</h3>
- <div>
- <p>Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.</p>
- </div>
- </div>
- */
Here is the Javascript:- <script>
- $(function() {
- $( "#accordion" ).accordion({
- collapsible: true
- });
- });
- </script>
This is what I have linked:- <link rel="stylesheet" href="../stylesheets/foundation.css">
- <link rel="stylesheet" href="../stylesheets/cheatsheet-styles.css">
- <link rel="stylesheet" href="../stylesheets/app.css"> <!-- styles the top bar -->
- <link rel="stylesheet" href="../stylesheets/buttons.css">
- <link rel="stylesheet" href="../stylesheets/demos.css"> <!-- accordion -->
- <script src="../cordova-2.3.0.js"></script> <!-- PhoneGap -->
- <script src="../javascripts/jquery.js"></script>
- <script src="../javascripts/jquery.ui.core.js"></script>
- <script src="../javascripts/jquery.ui.widget.js"></script>
- <script src="../javascripts/jquery.ui.accordion.js"></script>
- <script src="../javascripts/copyright.js"></script>
- <script src="../javascripts/topbar_a.js"></script> <!-- top bar dropdown nav contents on mobile -->
- <script src="../javascripts/wide_a.js"></script> <!-- left nav contents on tablets -->
(FYI: This code is sharing space with Zurb Foundation 3, and uses the Jquery that came with it. It works fine with the above HTML version when used apart from the database.)This above problem is not unique to Jquery UI (code taken from <http://jqueryui.com/accordion/#collapsible>). I've had exactly the same problem with 4 other Javascript accordions - I keep trying! I always try the accordion by itself; if it works, then I integrate it with the database + innerHTML.- 16-May-2012 02:45 PM
- Forum: jQuery Mobile
I have a delete button that deletes the data shown in a field on a data-role page, one of several div pages on this html page. After the user hits the delete button, I want to allow them to hit a Refresh button so they can see that the data has been cleared from the field.I have been unsuccessful in figuring out how to refresh the page so the correct data-role page shows up. I tried ...<a href="name.html"<a href="name.html#section"<a href="#section"... and none of these brings me back to the right page. I added rel="external" to each and that did not help.I tried making an image on the div page an anchor, but that did not work either: <a name="section"><img src="picture.jpg"></a>How do I refresh the page so I end up back in the div I want?- I have a delete button that deletes the data shown in a field on a data-role page, one of several div pages on this html page. After the user hits the delete button, I want to allow them to hit a Refresh button so they can see that the data has been cleared from the field.I have been unsuccessful in figuring out how to refresh the page so the correct data-role page shows up. I tried ...<a href="name.html"<a href="name.html#section"<a href="#section"... and none of these brings me back to the right page. I added rel="external" to each and that did not help.I tried making an image on the div page an anchor, but that did not work either: <a name="section"><img src="picture.jpg"></a>How do I refresh the page so I end up back in the div I want?
- If I use jquery-mobile.js, do all the elements in the documentation for jquery apply to jquery mobile? That is, should we be able to freely exchange the two js files and the site will continue to work?
I'm just not sure about the relationship between these code systems, and am seeking clarification.- 24-Apr-2012 02:53 PM
- Forum: jQuery Mobile
I have this for my page's wrapper, but it does not change the background color:
#wrapper {
width:100%;
background-color:red;
}
I also put it on the <body> tag and it did not change the gray color. The color first appeared, then the gray replaced it:
<body style="background-color:red">
I also used an image, and it was overlaid by the gray color. How do you override Jquery's background color without touching the Jquery CSS file?- 24-Apr-2012 01:46 PM
- Forum: Using jQuery
I have this for my page's wrapper, but it does not change the background color:
#wrapper {
width:100%;
background-color:red;
}
I also put it on the <body> tag and it did not change the gray color. The color appeared, then the gray on top.
<body style="background-color:red">
I also used an image, and it was overlaid by the gray color. How do you override Jquery's background color without touching the Jquery CSS file?- When I add an image to a list box row (between <li> tags), it becomes a thumbnail positioned to the left. I'd like to let it span the entire row's width. What do I do to make this happen? If the image is larger than the row, I need it to automatically reduce and not push the row out.
This is what I have, and doesn't work:- <ul data-role="listview" data-dividertheme="b">
<li data-role="list-divider">Full Web Site</li>
<li><a href="http://www.site.com/">site.com</a></li>
<li data-role="none"><img style="width:100%" src="http://www.site.com/pictures/car.jpg" alt="car" title="car">
</li></ul>
- I replaced jquery-1.6.2.min.js with jquery-1.7.2.min.js (from http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js) and the page went blank white. Am I supposed to do something to smooth the transition?
- 18-Apr-2012 11:44 AM
- Forum: Using jQuery
I notice when using Jquery that all content is to the left. How do I center the content on the screen? Wrapping the entire page with this div did not work:- <body style="text-align:center; width:100%">
- <div style="margin-left: auto; margin-right: auto;"> <!-- for IE -->
I have three div columns that float left inside the above div.
This is testing a fluid format; the layout adapts when the screen narrows (while also fitting perfectly on a smartphone):
http://www.teamassociated.com/downloads/webapp/fluid.html
I am using:
jquery.mobile-1.0rc1.js
jquery-1.6.2.min.js
jquery.mobile-1.0rc1.css- 17-Apr-2012 10:31 AM
- Forum: jQuery Mobile
Is it possible to enlarge one of the Jquery mobile pages' size to 1024px so I can include a 1024px image that the user can slide around to see the detail? This is for an iPhone device.If so, what do I need to change to make this happen?
Right now the image only scrolls up and down while the right portion of the image goes off the right side, and is not scrollable left to right. Of course, I want the rest of the pages to stay their own mobile-screen width.Thanks,Steve- 16-Apr-2012 02:46 PM
- Forum: Using jQuery
Is it possible to enlarge one of the Jquery pages' size to 1024px so I can include a 1024px image that the user can slide around to see the detail? This is for an iPhone device.If so, what do I need to change to make this happen?Thanks,Steve- 06-Apr-2012 06:34 PM
- Forum: Getting Started
I'd like to show a table list on the left half of an iPad screen, that, when a row is tapped, causes a separate HTML page of content to appear in the right half of the screen (whether slide, roll, pop, or fade does not matter). All the pages are individual HTML pages already, over 300 of them.
What part of jQuery does this navigational magic?
Thanks,
Steve- 13-Mar-2012 01:34 PM
- Forum: jQuery Mobile
The button following correctly runs the persistData() function when it is tapped in the iPhone device:<a href="#" rel="external" data-role="button" data-theme="e" onclick="persistData()">Save</a>
On the same div, the row following does not run the same function when tapped in the iPhone:
<li><a href="setup1.html" rel="external" data-transition="none" onclick="persistData()">Setup 1</a></li>
How do I get the row to run the function?- 01-Mar-2012 06:12 PM
- Forum: Getting Started
I use the Back button (data-add-back-btn="true") for all pages in the index.html page. But I use regular buttons at top of my external pages as a Home button to get back to the index.html page. Unfortunately, this mixture looks arbitrary.1. Is it possible to add the Back button to an external page? If so, what's the code?Thanks!- I'd like to make a catalog of our company's products, with one 150px image per page div in Jquery-Mobile. There'll be close to 4000 products. Has anyone had problems with this many page divs in Jquery-Mobile combined with PhoneGap for iOS?
- 04-Nov-2011 10:26 AM
- Forum: jQuery Mobile
According to the Apple docs, the round arrow in a list means that the next page is the final page. In Jquery, the default is the gray chevron pointing to another list.How do I make the round arrow (arrow in circle) icon appear instead? The icon is included in the distribution, but there are no instructions on using it.Thanks!- 01-Nov-2011 07:09 PM
- Forum: Getting Started
According to the Apple docs, the round arrow in a list means that the next page is the final page. In Jquery, the default is the gray chevron pointing to another list.How do I make the round arrow (arrow in circle) icon appear instead?Thanks!- 31-Oct-2011 11:47 AM
- Forum: jQuery Mobile
I have an app which has an HTML5 local storage form on separate pages, each page with its own form. So each page is linked to its own JS local storage code. Works fine.Now with JQuery mobile, everything is on one index.html page. I'm having a hard time getting more than one form on the same page to save to local storage. Any pointers? If you've had this problem, what was your solution?Thanks!- I'm using JQuery on an iPod touch. When I test the dialogs, the page first jumps to the top of the page before showing the dialog. Hitting the X to close the dialog, the top of the page shows, then jumps down to the place which had the dialog link.is there a way to keep the page from jumping up and down?Thanks!
- Entire sections of the JS file is seen as commented out inappropriately by Xcode. For example, on this line:[^\/*]+$/, '' );the /* begins to comment out a huge section of the code in the JS file. See the green sections:
//get path from current hash, or from a file path
get: function( newPath ) {
if( newPath === undefined ) {
newPath = location.hash;
}
return path.stripHash( newPath ).replace( /[^\/]*\.[^\/*]+$/, '' );
},
//return the substring of a filepath before the sub-page key, for making a server request
getFilePath: function( path ) {
var splitkey = '&' + $.mobile.subPageUrlKey;
return path && path.split( splitkey )[0].split( dialogHashKey )[0];
},
The above "commented-out" section ends here, many lines later:
}
} : undefined;
/*
internal utility functions
--------------------------------------*/
//direct focus to the page title, or otherwise first focusable element
function reFocus( page ) {
var pageTitle = page.find( ".ui-title:eq(0)" );
if( pageTitle.length ) {
pageTitle.focus();
}
else{
page.focus();
}
}
Could this extended section have an impact on how my HTML pages are styled?- I have the following at the head of my Jquery Mobile document:
<!-- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.3.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0b3/jquery.mobile-1.0b3.min.js"></script>
-->
<link type="text/css" rel="stylesheet" href="jqtouch/jquery_m.css" media="screen">
<script type="text/javascript" src="jqtouch/jquery.js" charset="utf-8"></script>
<script type="text/javascript" src="jqtouch/jquery-m.js" charset="utf-8"></script>
When I use the commented-out lines, the CSS styles the content beautifully. However, I want to use this in the iPod touch when there is no Internet or WiFi available. That meant copying the content from those links into files on the device. I copied the commented-out content into the files below those (as shown in the lines above).When I run the code on the device or in the Xcode simulator the content is completely unstyled. I've checked the file linking locations again and again, and they are fine.Is there a problem with copying/pasting the files the way I did?- 06-Oct-2011 04:54 PM
- Forum: jQuery Mobile
The following link is supposed to go to a different "page" on the same HTML page, right? Well, right now the page "slides" and goes to the top of the same page, not to the new div. Please let me know if I am styling the link properly. Yes, I am reading the docs!<li><a href="#aboutApp">About this App</a></li>
This is how the above "page" is styled, further down the HTML page:
<!-- Start of About this App -->
<div data-role="page" id="#aboutApp">
<div data-role="header">
<h1>About this App</h1>
</div><!-- /header -->
<div data-role="content">
<p>I'm first in the source order so I'm shown as the page.</p>
<p><a href="#home">Back to home</a></p>
</div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
The first "page" begins like this ...
<!-- Start of first page -->
<div data-role="page" id="home" data-theme="b">
<div data-role="header">
<h1>Setups</h1>
</div><!-- /header -->
<div data-role="content"><form name="form2">
... and ends like this (right out of the docs):
</form></div><!-- /content -->
<div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
- I copied and pasted the jquery.min.js code and half of it turned green, which means it's been commented out. I found the beginning of the comment in this line:
{if(a===
d)a=location.hash;return i.stripHash(a).replace(/[^\/]*\.[^\/*]+$/,"")}
The regular expression at /* shown above is also used to begin a multi-lline comment. How do I undo this?
- I created an index.html page with jquery and jqtouch incorporated. I added content within a <div="home"> and added textfields and <input> buttons that load, save and clear the textarea content successfully with an HTML 5 database. This all works on an iPod touch device.Now for the strange part.I copied this page into a folder in the same app and updated all the links with ../ to point them to the same places as before. I made a link from the first page to the second page (the copy). Now my <input> buttons don't fire on either page. Same page, different folder. Formerly, the buttons on the first page visibly changed state (slight color change) after tapping, but they don't respond at all now.Example of a button:
<input class="saveButton" type="button" value="Save/Update" onclick="persistData()">
I can go from page to page successfully, though with rel="external"I duplicated the first page to use as a template for the second page. Why doesn't this idea work?Am I going about this the wrong way? After all, the two pages share a lot of content in common.- I have this script:
<script type="text/javascript">
$(document).ready(function() {
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
$('#opener').click(function() {
$dialog.dialog('open');
// prevent the default action, e.g., following a link
return false;
});
});
</script>
But I don't know how to fire it (cause the dialog box to appear) using <input> to keep the button's styling in line with the rest of the page. This does not work:
<input class="loadButton" type="button" value="open dialog box" onclick="opener">
So how else do you fire the script?
Thanks!
- «Prev
- Next »
Moderate user : stevenhus
© 2013 jQuery Foundation
Sponsored by
and others.
- <ul data-role="listview" data-dividertheme="b">