Sticky Nav (Scroll Down!)





























<script>
    $(document).ready(function () {
    $(document).scroll(function () {
        // If has not activated (has no attribute "data-top"
        if (!$('.subnavtest').attr('data-top')) {
            // If already fixed, then do nothing
            if ($('.subnavtest').hasClass('subnavtest-fixed')) return;
            // Remember top position
            var offset = $('.subnavtest').offset()
            $('.subnavtest').attr('data-top', offset.top);
        }

        if ($('.subnavtest').attr('data-top') - $('.subnavtest').outerHeight() <= $(this).scrollTop())
            $('.subnavtest').addClass('subnavtest-fixed');
        else
            $('.subnavtest').removeClass('subnavtest-fixed');
    });
});
</script>





















































My Showcase

Copyright © 2013 Chris Hanna