1/** 2 * @file 3 * Global utilities. 4 * 5 */ 6(function ($, Drupal) { 7 8 'use strict'; 9 10 Drupal.behaviors.bootstrap_barrio_subtheme = { 11 attach: function (context, settings) { 12 var position = $(window).scrollTop(); 13 $(window).scroll(function () { 14 if ($(this).scrollTop() > 50) { 15 $('body').addClass("scrolled"); 16 } 17 else { 18 $('body').removeClass("scrolled"); 19 } 20 var scroll = $(window).scrollTop(); 21 if (scroll > position) { 22 $('body').addClass("scrolldown"); 23 $('body').removeClass("scrollup"); 24 } else { 25 $('body').addClass("scrollup"); 26 $('body').removeClass("scrolldown"); 27 } 28 position = scroll; 29 }); 30 /* LAZY LOAD */ 31 [].forEach.call(document.querySelectorAll('img[data-src]'), function (img) { 32 img.setAttribute('src', img.getAttribute('data-src')); 33 img.onload = function () { 34 img.removeAttribute('data-src'); 35 }; 36 }); 37 $(document).on('click', '.js-show_more', function () { 38 $(this).parents('.js-more-wrapper').find('.js-more_item').removeClass('d-none'); 39 $(this).parents('.js-more-wrapper').find('.js-more-btn').addClass('d-none'); 40 return false; 41 }); 42 $(document).click(function (event) { 43 if ($(event.target).closest(".js-select-city").length) return; 44 if ($(event.target).closest(".select-city-block__wrapper").length) return; 45 $('.select-city-block__wrapper').addClass('d-none'); 46 event.stopPropagation(); 47 }); 48 $(document).on('click', '.js-select-city', function () { 49 $('.select-city-block__wrapper').toggleClass('d-none'); 50 return false; 51 }); 52 $(document).on('click', '.js-select-city__footer', function () { 53 $('html, body').animate({ 54 scrollTop: $(".select-city-block__wrapper").offset().top 55 }, 500); 56 $('.select-city-block__wrapper').toggleClass('d-none'); 57 return false; 58 }); 59 } 60 }; 61 62 /*ÐлаÑÑиковÑе окна <ÐÑоизводиÑелÑ> ÑвоÑаÑивание ÑекÑÑа на главном блоке*/ 63 $( '.showText' ).click(function() { 64 65 $( '.myShowBlock' ).show(1200); 66 $( '.showText' ).hide(); 67 }); 68 69 $('.accordion-item .heading').click(function(e) { 70 e.preventDefault(); 71 if ($(this).closest('.accordion-item').hasClass('active')) { 72 $('.accordion-item').removeClass('active'); 73 } else { 74 $('.accordion-item').removeClass('active'); 75 $(this).closest('.accordion-item').addClass('active'); 76 } 77 var $content = $(this).next(); 78 $content.slideToggle(200); 79 $('.accordion-item .content').not($content).slideUp('fast'); 80 }); 81 82 83})(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.