Sha256: 7ba1efd65c870661fc2b40633e744cdac63c553b8e96cdf66c163b2bad17cd09
Contents?: true
Size: 672 Bytes
Versions: 9
Compression:
Stored size: 672 Bytes
Contents
//= require_self $(function() { $("body").attr("data-spy", "scroll").attr("data-target", ".subnav").attr('data-offset', "50"); $(document).scroll(function(){ // If has not activated (has no attribute "data-top" if (!$('.subnav').attr('data-top')) { // If already fixed, then do nothing if ($('.subnav').hasClass('subnav-fixed')) return; // Remember top position var offset = $('.subnav').offset() $('.subnav').attr('data-top', offset.top); } if ($('.subnav').attr('data-top') - $('.subnav').outerHeight() <= $(this).scrollTop()) { $('.subnav').addClass('subnav-fixed'); } else { $('.subnav').removeClass('subnav-fixed'); } }); })
Version data entries
9 entries across 9 versions & 1 rubygems