1/** 2 * @file 3 * Affix for Bootstrap 4. 4 * https://www.codeply.com/users/skelly 5 * 6 */ 7(function ($, Drupal) { 8 9 'use strict'; 10 11 Drupal.behaviors.bootstrap_barrio_affix = { 12 attach: function (context, settings) { 13 var toggleAffix = function (affixElement, scrollElement, wrapper) { 14 15 var height = affixElement.outerHeight(), 16 top = wrapper.offset().top; 17 18 if (scrollElement.scrollTop() >= top){ 19 wrapper.height(height); 20 affixElement.addClass("affix"); 21 } 22 else { 23 affixElement.removeClass("affix"); 24 wrapper.height('auto'); 25 } 26 27 }; 28 29 $('[data-toggle="affix"]').once().each(function () { 30 var ele = $(this), 31 wrapper = $('<div></div>'); 32 33 ele.before(wrapper); 34 $(window).on('scroll resize', function () { 35 toggleAffix(ele, $(this), wrapper); 36 }); 37 38 // init 39 toggleAffix(ele, $(window), wrapper); 40 }); 41 } 42 } 43})(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.