1(function($, Drupal, once, drupalSettings){ 2 "use strict"; 3 4 Drupal.behaviors.DX8ParallaxScrolling = { 5 6 attach: function (context, settings){ 7 8 var cmm = new Drupal.CohesionResponsiveBreakpoints(); 9 10 var resetCSS = { 11 'background': '', 12 'transform': '', 13 'transition': '', 14 'will-change': '', 15 'background-position-y': '', 16 'background-position-x': '' 17 }; 18 19 var count = 0; 20 var total = 0; 21 22 function initParoller(settings) { 23 24 var key = settings.cohesion.key, 25 settings = settings.cohesion.settings, 26 $el = settings.$el; 27 28 if(!count) { 29 total = $('[data-coh-paroller]', context).length; 30 count = total; 31 } 32 33 if(count === total) { 34 //Ensure that unbind only happens the first time we loop round the elements. 35 $(window).off('.paroller'); 36 } 37 38 count--; 39 40 // Always wipe the CSS when changing between breakpoints 41 $el.css(resetCSS); 42 43 if(settings.breakpoints[key].enabled){ 44 45 // Init the paroller elements 46 $el.paroller({ 47 factor: settings.breakpoints[key].factor, 48 direction: settings.breakpoints[key].direction, 49 type: settings.breakpoints[key].type, 50 bgstart: settings.breakpoints[key].bgstart 51 }); 52 } 53 } 54
55 $(once('dx8-js-parallax-init', '[data-coh-paroller]', context)).each(function(){ 56 var $el = $(this); 57 var responsiveSettings = $el.data('coh-paroller'); 58 var key, previous; 59 var settings = { 60 $el: $el, 61 breakpoints: {} 62 }; 63 64 for (var i = 0; i < cmm.breakpoints.length; i++) { 65 66 key = cmm.breakpoints[i].key; 67 68 // Populate all breakpoints regardless of whether the settings are set or not to simulate inheritance 69 settings.breakpoints[key] = {}; 70 if (typeof responsiveSettings[key] !== 'undefined') { 71 72 settings.breakpoints[key] = responsiveSettings[key]; 73 74 previous = responsiveSettings[key]; 75 76 } else { 77 78 if (typeof cmm.breakpoints[i - 1] !== 'undefined' && typeof previous !== 'undefined') { 79 settings.breakpoints[key] = previous; 80 } 81 } 82 } 83 84 cmm.addListeners(settings, initParoller); 85 }); 86 } 87 }; 88 89})(jQuery, Drupal, once, drupalSettings);
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.