javascript - offset().top not working in Safari -


issue offset (). Top Safari does not work but works fine on all other browsers but there is no suggestion to break into Safari?

  $ (window) .scroll (function () {collapseNav ();}); Function name () (if ($ (".navbar") offset (). Top & gt; 50) {// code here} other {// code here}}  

You can fix this problem like this

 < Code> // 1.4.2 as the mobile safari offset () // reports bad values ​​on http://dev.jquery.com/ticket/6446 // Once it is fixed it is removed (/webkit.*mobile/i.test(navigator UserAgent)) {(function ($) {$ .fn.offsetOld = $ .fn.offset; $ .fn.offset = function () {var results = this. OffsetOld (); result.top - = window.scrollY; result Left - = window.scrollX; return result;};}) (jQuery);}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -