1/** 2 * stick date titles to top 3 * @param stickies 4 */ 5function stickyTitles(stickies) { 6 var self = this, 7 isLoaded = false; 8 9 this.load = function() { 10 stickies.each(function() { 11 var thisSticky = jQuery(this); 12 if (!self.isLoaded) { 13 thisSticky.wrap('<div class="followWrap" />'); 14 thisSticky.parent().height(thisSticky.outerHeight()); 15 } 16 17 jQuery.data(thisSticky[0], 'pos', thisSticky.offset().top); 18 }); 19 20 self.isLoaded = true; 21 }; 22 23 this.scroll = function() { 24 var offsetTop = (parseInt(jQuery(document.body).css('padding-top')) || 0) + 55, // 33px allocated by nav-tabs 25 isFloating = false; 26 27 stickies.each(function(i) { 28 29 var thisSticky = jQuery(this), 30 pos = thisSticky.hasClass('fixed') 31 ? jQuery.data(thisSticky[0], 'pos') 32 : thisSticky.offset().top; 33 34 jQuery.data(thisSticky[0], 'pos', pos); 35 pos -= offsetTop; 36 37 if (pos <= jQuery(window).scrollTop()) { 38 if (!thisSticky.hasClass('fixed')) { 39 $('.schedule-heading .dropdown').removeClass('open'); 40 } 41 thisSticky.addClass("fixed container"); 42 43 } else { 44 if (thisSticky.hasClass('fixed')) { 45 $('.schedule-heading .dropdown').removeClass('open'); 46 } 47 thisSticky.removeClass("fixed container"); 48 } 49 50 // Remove the fixed class if the sedction is no longer in the viewport 51 // This + 220 is because of the paddings and margins that form empty space. 52 53 if ($('.sticked .end-div').offset().top < (jQuery(window).scrollTop() + 220)) { 54 thisSticky.removeClass("fixed container"); 55 } 56 57 }); 58 59 if (isFloating) { 60 jQuery('.schedule').addClass('floating'); 61 } 62 else { 63 jQuery('.schedule').removeClass('floating'); 64 65 } 66 } 67} 68 69// expand menu on click 70jQuery('.schedule > ul li a').click(function(event) { 71 event.preventDefault(); 72 jQuery(this).toggleClass('expand'); 73}); 74 75 76function loadStickyTitles() { 77 var newStickies = new stickyTitles(jQuery(".day-floating")); 78 newStickies.load(); 79 80 jQuery(window).on("resize", newStickies.load); 81 jQuery(window).on("scroll", newStickies.scroll); 82} 83 84jQuery(document).ready(function() { 85 loadStickyTitles(); 86});
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.