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

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -