1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6(function ($, Drupal) { 7 8 'use strict'; 9 10 Drupal.behaviors.bootstrap_barrio = { 11 attach: function (context, settings) { 12 13 var position = $(window).scrollTop(); 14 $(window).scroll(function() { 15 if ($(this).scrollTop() > 50){ 16 $('body').addClass("scrolled"); 17 } 18 else{ 19 $('body').removeClass("scrolled"); 20 } 21 var scroll = $(window).scrollTop(); 22 if (scroll > position) { 23 $('body').addClass("scrolldown"); 24 $('body').removeClass("scrollup"); 25 } else { 26 $('body').addClass("scrollup"); 27 $('body').removeClass("scrolldown"); 28 } 29 position = scroll; 30 }); 31 32 var toggleAffix = function(affixElement, scrollElement, wrapper) { 33 var height = affixElement.outerHeight(), 34 top = wrapper.offset().top; 35 if (scrollElement.scrollTop() >= top){ 36 wrapper.height(height); 37 affixElement.addClass("affix"); 38 } 39 else { 40 affixElement.removeClass("affix"); 41 wrapper.height('auto'); 42 } 43 }; 44 $('[data-toggle="affix"]').each(function() { 45 var ele = $(this), 46 wrapper = $('<div></div>'); 47 ele.before(wrapper); 48 $(window).on('scroll resize', function() { 49 toggleAffix(ele, $(this), wrapper); 50 }); 51 // init 52 toggleAffix(ele, $(window), wrapper); 53 }); 54 } 55 }; 56 57})(jQuery, Drupal);
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.