1 2(function ($, Drupal, window, document, undefined) { 3 Drupal.behaviors.smoothScroll2 = { 4 attach: function(context, settings) { 5 6 7 $(function() { 8 var speed = 500; 9 var offset = 0; 10 //* Dont use default browser anchor, we put 'sm-' before 11 // Thanks to https://stackoverflow.com/a/30293936/2270775 12 // *only* if we have anchor on the url 13 if(window.location.hash && window.location.hash.indexOf('sm-') == 1) { 14 // console.log("test"); 15 // smooth scroll to the anchor id 16 anchor = window.location.hash; 17 window.location.hash = ""; 18 anchor = anchor.replace("#sm-", "#"); 19 // console.log(typeof anchor); 20 // $(anchor).css("background","tomato"); 21 if($(anchor).length){ 22 $('html, body').animate({ 23 scrollTop: ($(anchor).offset().top - offset) + 'px' 24 }, speed, 'swing'); 25 } 26 } 27 28 // -- Front page scrolling 29 // Thanks to https://css-tricks.com/snippets/jquery/smooth-scrolling 30 // Select all links with hashes that are not accordion and not carrossel 31 $('a[href*="#sm-"], a[data-smooth-scrol]') 32 .on('click', function(event) { 33 // Figure out element to scroll to 34 var target; 35 if($(this).is("[data-smooth-scroll]")){ 36 target = $((this).attr("data-smooth-scroll")); 37 }else{ 38 target = $(this.hash.replace("#sm-", "#")); 39 } 40 // console.log(target); 41 // target = target.replace("#sm-", "#"); 42 // Does a scroll target exist? 43 if (target.length) { 44 // Only prevent default if animation is actually gonna happen 45 event.preventDefault(); 46 $('html, body').animate({ 47 scrollTop: target.offset().top - offset + 'px' 48 }, speed, 'swing'); 49 } 50 }); 51 }); 52 } 53 }; 54 55 56})(jQuery, Drupal, this, this.document); 57 58
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.