DTE :]

Sunday, May 6, 2012

Sticky Nav

(function($) {
    var $window = $(window),
        $nav = $('nav'),
        offset = $nav.offset().top;
    $window.on("scroll", function() {
        if (offset < $(this).scrollTop()) {
            $nav.addClass('fixed');
        } else {
            $nav.removeClass('fixed');
        }
    });
})(jQuery);

Lihat Demo

Labels: , ,

24 Comments:

Post a Comment



<< Home