When your website means business.

Javascript, jQuery | Type: JavascriptFix to Top Onscroll

Positions element at top on scrolling using jQuery scrollTop

<script>
jQuery(function ($) {
$(window).scroll(function(){
    var scroll = $(window).scrollTop();
    if (scroll >= 279){
         $('.scroller').css({position:'fixed',top:15,width:160});
    } else {
         $('.scroller').css({position:'relative',top:0});
    }
});
});
</script>

//for object with class "scroller"; also note define object width for fixed, as it seems to disregard previously set width.
Menu
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Cookies Notice