Sha256: b084109dddaa85c67c5dadd8eed321a8a82b2ddc97f077dafbca43288937315d
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
// header var $header = $('.header'), headerHeight, headerNavMinWidth = 0; // header affix function runHeaderAffix() { var $header = $('.header'); $(window).on('scroll', function() { if ($('.header').length) { if (window.pageYOffset > headerHeight) { $header.addClass('fixed'); } else { $header.removeClass('fixed'); } }; }); } // header height headerHeightCal = function () { if ($('.header').length) { headerHeight = $header.height(); }; } function runHeaderNavPos() { if ($('.header-nav-scroll').length) { $('.header-nav-scroll .nav > li').each(function(index) { var $this = $(this); if (index < 3) { headerNavMinWidth += $this.width(); } else { return false; } }); }; } headerNavPos = function () { var $headerNav = $('.header-nav-scroll'); $headerNav.removeClass('pull-down'); if ($headerNav.width() < headerNavMinWidth) { $headerNav.addClass('pull-down'); } else { $headerNav.removeClass('pull-down'); } } document.addEventListener('DOMContentLoaded', function() { runHeaderAffix(); runHeaderNavPos(); }, false);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
material-sass-0.0.4 | app/assets/javascripts/material/header.js |