Callback Function To Be Executed After Jquery Show / Hide?
In iOS, the following code has a noticeable flicker between the hide() and the scrollBy(): element.hide(); window.scrollBy(0, -elementHeight); This is because toggling between dis
Solution 1:
Either pass a duration and a callback, or just pass a callback option, like this:
element.hide(0, some_function);
// or
element.hide({done: some_function});
By default, the second option takes 400 ms. To do it immediately, use one of these:
element.hide(0, some_function);
// or
element.hide({duration: 0, done: some_function});
See the jQuery documentation for more details.
Solution 2:
From the jQuery api:
.hide(options)
complete Type: Function() A function to call once the animation is complete.
Try this:
element.hide({complete: function(){ window.scrollBy(0, -elementHeight); });
Post a Comment for "Callback Function To Be Executed After Jquery Show / Hide?"