1jQuery(document).ready(function ($) { 2 function glideTo(top) { 3 $('html, body').animate({ scrollTop: top }, 800); 4 } 5 6 // Back to top 7 $(".sfm-floating-menu a.sfm-scroll-to-top").on('click', function (event) { 8 event.preventDefault(); 9 glideTo(0); 10 }); 11 12 // Down to the end of the page 13 $(".sfm-floating-menu a.sfm-scroll-to-bottom").on('click', function (event) { 14 event.preventDefault(); 15 glideTo($(document).height() - $(window).height()); 16 }); 17 18 // Add smooth scrolling to all links 19 $(".sfm-floating-menu a").on('click', function (event) { 20 // Store hash 21 var hash = this.hash; 22 // Make sure this.hash has a value before overriding default behavior 23 // A bare "#" is what the scroll actions carry, and $("#") is not a 24 // selector jQuery accepts. 25 if (hash !== "" && hash !== "#" && $(hash).length > 0) { 26 // Prevent default anchor click behavior 27 event.preventDefault(); 28 29 // Using jQuery's animate() method to add smooth page scroll 30 // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area 31 // The menu may ask for room above whatever it scrolls to. 32 var offset = parseInt($(this).closest('.sfm-floating-menu').attr('data-scroll-offset'), 10) || 0; 33 34 $('html, body').animate({ 35 scrollTop: $(hash).offset().top - offset 36 }, 800, function () { 37 38 // Add hash (#) to URL when done scrolling (default click behavior) 39 window.location.hash = hash; 40 }); 41 } // End if 42 }); 43});
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.