1 2; 3(function($, window, document, undefined) { 4 var OnePageNav = function(elem, options) { 5 this.elem = elem; 6 this.$elem = $(elem); 7 this.options = options; 8 this.metadata = this.$elem.data('plugin-options'); 9 this.$nav = this.$elem.find('a'); 10 this.$win = $(window); 11 this.sections = {}; 12 this.didScroll = false; 13 this.$doc = $(document); 14 this.docHeight = this.$doc.height() 15 }; 16 OnePageNav.prototype = { 17 defaults: { 18 currentClass: 'current', 19 changeHash: false, 20 easing: 'swing', 21 filter: '', 22 scrollSpeed: 750, 23 scrollOffset: 0, 24 scrollThreshold: 0.5, 25 begin: false, 26 end: false, 27 scrollChange: false 28 }, 29 30 scrollChange: function() { 31 var windowTop = this.$win.scrollTop(); 32 var position = this.getSection(windowTop); 33 var $parent; 34 if (position !== null) { 35 $parent = this.$elem.find('a[href$="#' + position + '"]').parent(); 36 if (!$parent.hasClass(this.config.currentClass)) { 37 this.adjustNav(this, $parent); 38 if (this.config.scrollChange) { 39 this.config.scrollChange($parent) 40 } 41 } 42 } 43 }, 44 unbindInterval: function() { 45 clearInterval(this.t); 46 this.$win.unbind('scroll.onePageNav') 47 } 48 }; 49 OnePageNav.defaults = OnePageNav.prototype.defaults; 50 $.fn.onePageNav = function(options) { 51 return this.each(function() { 52 new OnePageNav(this, options).init() 53 }) 54 } 55})(jQuery, window, document);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.