I'm trying to load an external static html page into a JQM app (div, iframe, any will do) the following way (I'm currently using a div):
// load html from external (though same server) html page
$.get(externalHtmlFolder '/filename.html', function (data)
{
// change the html so that the path to css is correct from the app's location
data = data.replace('href="stylesheets/style.css"', 'href="' + externalHtmlFolder + '/stylesheets/style.css"');
// insert the loaded and now altered html into a div on a jqm page
$('#invoice_html_container')[0].innerHTML = data;
});
And this appears to work.
Now unfortunately the css file loaded for the external html page "style.css" seems to be messing with JQM's styles in the rest of the app, after the page is loaded.
Is there a way to prevent this or does anyone know of a better way to achieve what I'm trying to do here?
I'm trying to make my footer fixed so that it doesn't scroll along with the content, but I can't seem to make it work. The closest I get is that the footer is invisible when content is being scrolled and then reappears once scrolling has stopped, though that is not the behavior I'm looking for.
I'm aware of the fact that "position:fixed" and "overflow:auto" can be an issue with some browsers, but the ones I'm developing for apparently must support this because I can see others have made this work perfectly.
Check this Sencha sample: Link And this Jo sample: Link (try clicking "Form Widgets" or something)
Both of these sites has both header and footer which are perfectly fixed and doesn't move when the content scrolls and I have tested these two links with both iPad2 (iOS 5.0.1) and Android 2.3 (Phone).
If they can make it work why can't I make the JQM fixed footer work?
I'm doing the following in attempt to achieve this:
$(document).bind("mobileinit", function () { $.mobile.touchOverflowEnabled = true; $.fixedToolbars.setTouchToggleEnabled(false); });
I also have the following bound to the "pageshow" event:
$('#page_support').live('pageshow', function (event) { var $page = $('#page_support'); var $listview = $('#supportCustomersList');
$page.page();
$listview.listview();
$('navigation').navbar(); });
What happens is that, to start with the page is empty except from a search box and a button. When I type a search text and hit the button, the request is posted and the response is received as expected. The listview items are also build as expected, BUT, the huge area (on iPad or browser) that was previously just empty space under the search box and down to the footer navbar, is still there, just pushed in front of the items, making the page longer (listview items + previously empty content = new length) and the navbar (even though it is set to data-position="fixed") has been pushed ahead of it all and is therefore no longer visible.
If I scroll in the list a few times, it seems to update the whole thing and the empty content disappears and the navbar appears again at the bottom of the page as supposed to.
- The question is, what am I missing to prevent this from happening? - And also, why can the navbar even be scrolled out of the visible area when it is supposed to be fixed (I see it on other pages as well, it is more like it is a part of the content area than the footer area).
I have a listview created and populated with items through markup injection and it works just fine - the items are styled as I'm expecting them to be or almost...
Each item has potentially none, 1 or 2 buttons on them and these buttons loose their style after the first load, by which I mean that, the first time the page holding the listview is shown the items appear as they should, buttons too.
But, every time the page is shown after this, only the items are styled, not the buttons on the items.
I have tried to bind to 'pageshow', 'pageinit' etc. to try and refresh my listview at this point, but it doesn't seem to make any difference. I'm starting to think that the buttons aren't refreshed just because the listview items are and that I need to do something additional to refresh the buttons as well.
My setup is like this (simplified) In my "pagebeforechange" I have the following:
if(<it is the correct page>)
{
showRegistrationsOverview(u, data.options);
e.preventDefault();
}
showRegistrationsOverview (simplified):
function showRegistrationsOverview(urlObj, options) { var pageSelector = urlObj.hash.replace(/\?.*$/, "");
var $page = $(pageSelector), $content = $page.children(":jqmData(role=content)");
if ($myListOfObjects != null) { var markup = '<ul data-role="listview" id="registrationsList" data-theme="c" data-dividertheme="c">';
for (var i = 0; i < $myListOfObjects.length; i++) { var reg = $myListOfObjects[i];
// $content.find(":jqmData(role=listview)").listview('refresh'); // also tried this
options.dataUrl = urlObj.href;
$.mobile.changePage($page, options);
}
This code creates the listview all over each time. It doesn't have to, clearing and adding items to and existing listview is cool too, this is just what I can get to work, well almost work.
Currently every time I run into problems with JQM it is about widgets loosing style, so I would really like to get this right once and for all.
I'm fairly new to JQ and JQM but not to web development in general.
I have read several posts about problems with item templates for listviews not being styled when added to the listview, but I haven't read any comments about how to make it work. Is it not supported yet or am I just doing something in a wrong order?
In my head section I have the following event handler for the page containing the listview:
$('#page_quicklinks').live('pageinit', function (event) { $("#quicklinkList").empty(); $.tmpl("ql_item_template", myArrayOfObjects).appendTo("#page_quicklinks"); $("#quicklinkList").listview("refresh"); });
What happens is that the items are added to the listview as expected, but they are not styled like they should be. If I hard code a few items just to test the styling, I can see that the hard coded items are styled. Am I doing something wrong or is this just not supported yet?