I need to fin开发者_Python百科d out what page is loaded in query mobile for a javascript script. I have been looking at: $.mobile.activePage but can't seem to work out how.
It would be good to have: if($.mobile.activePage = "#page"){
$.mobile.activePage
returns a jQuery object. SO you should probably try something like this:
if($.mobile.activePage.attr("id") == "page"){
You can get the currently active page by using $.mobile.activePage
If you want to test that a selected jQuery element is the current page you could look for the existence of the "ui-page-active" class:
if ($("#myPage").is(".ui-page-active")) { ... }
精彩评论