jquery - TypeError: $.mobile.activePage is undefined -
Hi friends I'm new in jQuery mobile and developing a website using it. I have created a function to control the height of the page according to the height of the window, when its work is fine, but when I am going to the unseen page, shutting it down and giving the error
TypeError: $ .mobile.activePage I do not know that the metter needs your help to solve this problem
Please give me Help people you can see your code below
USED LIBRARIES
& lt; Script src = "js / jquery-1.10.2.min.js" type = "text / javascript" language = "javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "js / jquery.mobile-1.4.0.min.js" type = "text / javascript" language = "javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "js / modernizr-2.6.1.min.js" type = "text / javascript" language = "javascript" & gt; & Lt; / Script & gt; & Lt; Script src = "js / script.js" type = "text / javascript" language = "javascript" & gt; & Lt; / Script & gt;
SCRIPT
var header_height = $ .mobile.activePage.children ('[data-role = "header"] ') .ite (), footer_height = $ .mobile.activePage.children (' [data-role = "footer"] '). Height (), window_height = $ (this) .height (), content_height = window_height - header_height - footer_height; .. $ .mobile.activePage.children ('[Data Role =' Content ']') Children ('. ContentMain') height (content_height -130) .css ('overflow', 'auto'); $ ('# -mainu left)' height (window_height) .css ('overflow', 'auto').
Please help me ... thanks in advance
That said, Jai,
For jQuery mobile, $ (document) .ready () and the finished devices are not the same.
It takes longer to load from the document.
You should do something like this:
$ (function () {document.addEventListener ('deviceready', onDeviceReady, false); // browser for test in Croatian / OnDeviceReady ();});
and
function onDevice Readie () {var header_height = $ .mobile.activePage.children ('[data-role = "header"]' ) Height (), window_height = $ (this) Light (), content_height = window_height - header_height - footer_height (tissue); .. $ .mobile.activePage.children ('[Data Role =' Content ']') Children ('. ContentMain') height (content_height -130) .css ('overflow', 'auto'); $ ('# -mainu left)' height (window_height) .css ('overflow', 'auto'). }
In addition to this, the active page has been deprecated. You can use
$ (".selector"). Page container ("getActivePage");
Source:
Comments
Post a Comment