javascript - Position fixed to the body come back to the top -
i want fix body there automatically scroll top of document , can't return was.
do know how can scroll in fixed body ?
this plunker : http://plnkr.co/edit/ubdtxtlx1mdl35tu6xyw?p=preview
with code jquery :
var topbody = $(window).scrolltop(); $("body").css("position","fixed"); $('html, body').animate( { scrolltop: topbody }, 0 );
are looking this: plunker?
jquery code:
$(function() { function fixedthebody() { var position = window.pageyoffset; $(".sample").css({ "position": "fixed", "height": "100%", "overflow-x": "hidden" }).animate({ scrolltop: position }, 0); } button.onclick = fixedthebody; });
Comments
Post a Comment