javascript - Script works in chrome but not in firefox -
I have a script that works fine in Chrome but not in Firefox and I do not know why it is
Example How I'm using the script below!
& lt; Nav> & Lt; Ul & gt; & Lt; Li & gt; & Lt; One square = "scroll" target = "home" & gt; Home & lt; / A & gt; & Lt; / li & gt; & Lt; / Ul & gt; & Lt; / Neo & gt; & Lt; Div id = "home" & gt; ..... & lt; / Div & gt; & Lt; Script & gt; $ ('. Scroll') (function () {$ (document) .amamate ({scrollTop: eval ($ ('#' + $ (this) .attr ('target')) Offset () - 70 )}, 1000);}); & Lt; / Script & gt;
Change $ (document) from .animate to $ ('HTML, body') Chetan .
He said, I have HTML-standard hash links to your code, if javascript is disabled or not working:
< Code> "scroll" href = "# house" & gt; Home & lt; / A & gt; & Lt; / li & gt; & Lt; Li & gt; ; Then modify the code to adjust it and remove the unnecessary eval statement: $ ('. scroll' ). Click (function (e) {e.preventDefault (); $ ('html, body'). Animate ({scrollTop: $ ($ (this) .attr ('href')) offset () top-70} , 1000);});
Comments
Post a Comment