html5 - jquery page navigation dynamic js load issue -
i using page navigation , using .live pageshow event this
$('#watchlist').live('pageshow', function(event) { watchlist(); });
it giving correct result expect if want add javascript file on templates, can can use other functionality perticular templates.
i want load dynamic templates js on templates not js file on index page becoz conflicting somewhere
intro
this answer response comment
"i want page navigation different html page including different js , css file thats it.. ".
to understand answer lets discuss how jquery mobile works. uses ajax load other pages dom
.
first page loaded normally. head
, body
loaded dom
, , there await other content. when second page loaded, body
content loaded dom
.
solutions
there 2 solutions here:
solution 1
in second page, , every other page, move script
, link
, style
tags body
content, this:
<body> <script> // javascript go here </script> <link rel="stylesheet" href="some.css" /> // , rest of html content </body>
this quick solution me ugly solution.
solution 2
use rel="external" in buttons , every elements using change page. because of ajax not going used page loading , jquery mobile app behave normal web application.
<a href="#second" class="ui-btn-right" rel="external">next</a>
official documentation, chapter: linking without ajax. unfortunately mobile app lose page transitions because of this.
Comments
Post a Comment