data-scroll="true"
works fine if the page is static page, but if I add page dynamically using javascript it does not work.
My Header section is :
<link rel="stylesheet" href="css/jquery.mobile-1.0rc2.css" />
<link rel="stylesheet" href="css/jquery.mobile.scrollview.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.0rc2.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="js/jquery.mobile.scrollview.js"></script>
<script type="text/javascript" src="js/scrollview.js"></script>
I also added the data-scroll
attribute and set it to true
using javascript, below is my code :
var pageHtml = "<div data-role='page' data-scroll='true' id=page" + pageId + " data-url=page" + pageId + ">";
var pageHeader = "<div data-role='header' data-position='fixed'><h1>" + menuItem + "</h1></div>";
var pageContent = "<div data-role='content' id='page" + pageId + "Content'></div>";
var page = pageHtml + pageHeader + pageContent + "</div>";
$(page).appendTo($.mobile.pageContainer);
Please help me...
Try something like this:
I had the same problem, worked for me.
Better later than never :-)
After a long research, what I found is-
we need to load the dynamic HTML, for each scroll block, to unique container s.
for eg.-
HTML
JS
if we loaded a scrollview on 'scrollContainer' at first,
then next time, we need to load in a different container-
Optional
To again dynamically load into
#scrollContainer
, we can remove & recreate the<div>
. after executing the second code blockother solutions should be there, but this one really works.
You need to JQM apply that page - try
or even
Hope this helps
UPDATE: here's the JQM documentation on how to officially do this