1// smooth scroll to anchor, with option of hash appearing in url. Thanks: 2// https://paulund.co.uk/smooth-scroll-to-internal-links-with-jquery 3$(document).ready(function(){ 4 // $('a[href^="#"]').on('click',function (e) { 5 // e.preventDefault(); 6 // var target = this.hash; 7 // var $target = $(target); 8 // $('html, body').stop().animate({ 9 // 'scrollTop': $target.offset().top 10 // }, 750, 'swing', function () { 11 // window.location.hash = target; 12 // }); 13 // }); 14 15 // Select all links with hashes 16$('a[href*="#"]') 17// Remove links that don't actually link to anything 18.not('[href="#"]') 19.not('[href="#0"]') 20.click(function(event) { 21 // On-page links 22 if ( 23 location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 24 && 25 location.hostname == this.hostname 26 ) { 27 // Figure out element to scroll to 28 var target = $(this.hash); 29 target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 30 // Does a scroll target exist? 31 if (target.length) { 32 // Only prevent default if animation is actually gonna happen 33 event.preventDefault(); 34 $('html, body').animate({ 35 scrollTop: target.offset().top 36 }, 600, function() { 37 // Callback after animation 38 // Must change focus! 39 var $target = $(target); 40 $target.focus(); 41 if ($target.is(":focus")) { // Checking if the target was focused 42 return false; 43 } else { 44 $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable 45 $target.focus(); // Set focus again 46 }; 47 }); 48 } 49 } 50}); 51 52 // Or use this to Open link in same window (similar to target=_blank) 53 $(".box").click(function(){ 54 window.location = $(this).find("a:first").attr("href"); 55 return false; 56}); 57 58// Show URL on Mouse Hover 59$(".box").hover(function () { 60 window.status = $(this).find("a:first").attr("href"); 61}, function () { 62 window.status = ""; 63}); 64});
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.