javascript - Stay in the same position after a jQuery's slideUp -


when click div (x), expands using .slidedown(), height increased, when detect scroll pass element (when x no longer in viewport), using inview plugin, close .slideup(), increased height goes normal state, instead of being @ (y), i'm @ (z)

after .slidedown()

x x x x y  <-- arrive here scrolling y z z 

after .slideup()

x x <-- height decreased y <-- instead of being here.. y  z <-- i'm here. z 

how can stay in same position after element's height decreased?

demo

whenever .slidedown() triggerd current srolltop position of page , set scroll position after .slideup() triggered. can use below code.

//get current position of page var pageposition = $(window).scrolltop();                 //set page position after `.slideup()` called $("html,body").scrolltop(pageposition); 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -