Sha256: 52e319c0247a591f5fc498c3d57045544753aad1ab1470da5526895cd786fb29
Contents?: true
Size: 670 Bytes
Versions: 1
Compression:
Stored size: 670 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrapped-rails-2.0.7.8 | vendor/assets/javascripts/bootstrapped_subnavigation.js |