var x = $(window).scrollTop(); $('.navigator-outer').click(function() { $('.wrapping').attr('style', 'top: -' + x + 'px'); });