1/** 2 * Smooth Scroll. 3 * 4 * Scrolls to the select 5 * 6 * @package Farmhouse Theme 7 * @author Restored 316 // Lauren Gaige 8 * @license GPL-2.0-or-later 9 * @link http://www.restored316designs.com/ 10 */ 11 12var restored = restored || {}; 13 14restored.smoothScroll = ( function( $ ) { 15 'use strict'; 16 17 var scrollSpeed = 1000, 18 19 scrollTo = function( clickedLink, event ) { 20 var target = $( clickedLink.hash ); 21 22 // Abort if link points outside the current page. 23 if ( window.location.hostname !== clickedLink.hostname ) { 24 return; 25 } 26 27 if ( window.location.pathname !== clickedLink.pathname ) { 28 return; 29 } 30 31 if ( 0 === target.length ) { 32 target = $( '[name=' + clickedLink.hash.slice( 1 ) + ']' ); 33 } 34 35 if ( 0 < target.length ) { 36 $( 'html,body' ).animate({ 37 scrollTop: target.offset().top 38 }, scrollSpeed ); 39 } 40 41 event.preventDefault(); 42 }, 43 44 /** 45 * Bind click events to scroll effect. 46 * Since 1.0.0 47 */ 48 init = function() { 49 $( 'a[href*="#"]:not([href="#"])' ).click( function( event ) { 50 scrollTo( this, event ); 51 }); 52 }; 53 54 // Expose the ready function. 55 return { 56 init: init 57 }; 58 59}( jQuery ) ); 60 61jQuery( restored.smoothScroll.init );
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.