jquery - Javascript scroll function slow, lots of "Timer Fired: onloadwff.js:310" weasel events in Chrome -
I'm trying to debug a page that seems to be working slowly in Chrome, That this may be an issue with the following javascript code:
$ (document) .ready (function () {function navScroll (distance) {$ (window) .scroll (function ( ) {Var scrollTop; if (distance) {scrollTop = () (= (; ($ ('(# $ $ $');) and {scrollTop = 150}; if ($ (window) .scrollTop ()> gt ; = ScrollTop) {if (! ($ ('$ MainNav') HCl ('ShowNew') {$ ('#NannNen') AddClass ('showNav');}} and (if ($ ('Main' Donation '). Haclus (' showyave ')) {$ (' # ' RemoveClass ('showNav');}}}}} If ($ ('.header-image-base'). Length) {var windowHeight = $ (window) .height (); $ ('.header -image-base '). CSS (' height ', window-height); naviscroll (windowsite);} and {navScroll ();}});
When I use Chrome's console' Timeline 'panel, and press the record, this is what I see:
Any idea what's going on here? I can not find any reference to this on Google and It does not know how to remedy.
Your page is most likely to be slow because you Adding a handler to the window scroll event & mdash; this is not a good practice below as explained below:
It is very good Fine, bad idea is that the window scroll event depends on the browser that scroll events can extract a lot and inserting the code into the scrollback will slow down any effort to scroll the page (not a good idea). Scroll handler Any performance drop in (s), as a result, will only compile the performance of the overall scrolling. Instead, it is necessary to check each X millisecond To use some form of new timer is better to engage a scrolling event and only after a delay (or even after a certain number of executions, and then after a delay) to run your code. ()
Your screenshot shows that onloadwff.js is located on chrome-extension: // hdokiejnpimakedhajhdlcegeplioahd
which means LastPass extension's & rsquo; As seen below, this is probably not related to your performance issue.
()
Link -
Comments
Post a Comment