javascript - Keeping the mouse on an element when content loads above it -


i have button that, when clicked, adds or removes content above it.

the problem when content loads scrolls page mouse no longer on button, , makes hard click again.

my question is, there (jquery) preferred technique keeping mouse on button?

if know pixels of element being added do

var currentpos = $(window).scrolltop();  addelementwithcallback(function() {     var adjustment = 20;     $(window).scrolltop(currentpos + adjustment); }); 

there better way this, off top of head, easiest.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -