1(function($) { 2 3 /** 4 * Copyright 2012, Digital Fusion 5 * Licensed under the MIT license. 6 * http://teamdf.com/jquery-plugins/license/ 7 * 8 * @author Sam Sehnert 9 * @desc A small plugin that checks whether elements are within 10 * the user visible viewport of a web browser. 11 * only accounts for vertical position, not horizontal. 12 */ 13 14 $.fn.visible = function(partial) { 15 16 var $t = $(this), 17 $w = $(window), 18 viewTop = $w.scrollTop(), 19 viewBottom = viewTop + $w.height(), 20 _top = $t.offset().top, 21 _bottom = _top + $t.height(), 22 compareTop = partial === true ? _bottom : _top, 23 compareBottom = partial === true ? _top : _bottom; 24 25 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 26 27 }; 28 29})(jQuery); 30 31(function ($, Drupal) { 32 33 'use strict'; 34 35 Drupal.behaviors.homepageAnimation = { 36 attach: function (context) { 37 const homepage = $('.l-homepage-2', context); 38 if (!homepage || homepage.length < 1) return; 39 const win = $(window); 40 const allMods = $( 41 ".paragraph--type-compound-featured-card-grid .l-grid > .paragraph," + 42 ".paragraph--type-compound-featured-card-grid .l-section__title," + 43 ".paragraph--type-compound-blockquote-grid .l-grid > .field .field__item > .paragraph," + 44 ".paragraph--type-compound-blockquote-grid .l-section__title," + 45 ".sign-up-bar," + 46 ".banner-bar," + 47 ".icon-bar," + 48 ".layout--twocol > .l-section__content," + 49 ".paragraph--type-simple-headline", 50 homepage 51 ); 52 53 allMods.each(function(i, el) { 54 const $el = $(el); 55 if ($el.visible(true)) { 56 $el.addClass("already-visible"); 57 } 58 }); 59 60 win.scroll(function(event) { 61 allMods.each(function(i, el) { 62 const $el = $(el); 63 if ($el.visible(true)) { 64 $el.addClass("come-in"); 65 } 66 }); 67 }); 68 } 69 } 70 71})(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.