Adding a time delay to a JQuery function?
I have the scrollplane script:
$(function()
{
$('#resume').jScrollPane(
{
autoReinitialise: true
}
);
});
Which allows my overflow: auto container to full load and be totally displayed when scrolled. Unfortun开发者_开发技巧ately this give me text jitters in Chrome but not Firefox. I'm guessing it's on each "reinitiate."
jitters in Chrome browser
I'm thinking of taking out "autoreinitialize" and add a "delay()" on firing the function allowing all the images/fonts to download, not changing the size of the container would do the same thing. I just don't know how to implement it and delay the function from firing.
Any help and/or guidance gratefully accepted.
PChuprina
search for window.setTimeout. using that you can delay execution of some piece of code.
setTimout is ok too, but JQuery has delay() function
Be aware, although I never had problems with delay():
The .delay() method is best for delaying between queued jQuery effects. Because it is limited—it doesn't, for example, offer a way to cancel the delay—.delay() is not a replacement for JavaScript's native setTimeout function, which may be more appropriate for certain use cases.
Good luck & happy coding
精彩评论