i'm working with jquery mobile and i love the multiple page concept, where you could replace the hole page with another page by just refer to their id.
now my app has a navbar (of course), and i hate that when i'm clicking on a link in the navbar the whole page is swiping to the left (inclusive the navbar) and the other page is coming from the right.
i just want to replace the content div, the navbar should be fixed on the bottom without refreshing the whole time! do you know what i mean? if i'm just refer to the content div id, it's not working like i refer to the page id.
i hope you know what i mean. so how can i handle this?
One way of doing that would be to override the click
event of the link, and replacing the content of the div (the target) with new content. Doing so in jQuery is trivial, e.g.
$('#replacement-target').html( $('#source-content').html() );
To play along with jQuery, you may need to call refresh
on the content to ensure that it is properly styled by the framework.
See this jsFiddle for an example.
$('#replacement-target-page-id div[data-role="content"]').replaceWith(
function(return$('#source-content-page-id div[data-role="content"]').contents();)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With