1(function ($) { 2 3 'use strict'; 4 5 g1.backToTop = function () { 6 var $scrollToTop = $('.g1-back-to-top'); 7 8 // init 9 toggleVisibility($scrollToTop); 10 11 $scrollToTop.on('click', function (e) { 12 e.preventDefault(); 13 14 var multipier = 200; 15 var durationRange = { 16 min: 200, 17 max: 1000 18 }; 19 20 var winHeight = $(window).height(); 21 var docHeight = $(document).height(); 22 var proportion = Math.floor(docHeight / winHeight); 23 24 var duration = proportion * multipier; 25 26 if (duration < durationRange.min) { 27 duration = durationRange.min; 28 } 29 30 if (duration > durationRange.max) { 31 duration = durationRange.max; 32 } 33 34 $('html, body').animate({ 35 scrollTop: 0 36 }, duration); 37 }); 38 39 $(window).scroll(function() { 40 window.requestAnimationFrame(function () { 41 toggleVisibility($scrollToTop); 42 }); 43 }); 44 }; 45 46 function toggleVisibility ($scrollToTop) { 47 if ($(window).scrollTop() > 240) { 48 $scrollToTop.addClass('g1-back-to-top-on').removeClass('g1-back-to-top-off'); 49 } else { 50 $scrollToTop.addClass('g1-back-to-top-off').removeClass('g1-back-to-top-on'); 51 } 52 } 53 54 $(document).ready(function () { 55 g1.backToTop(); 56 }); 57})(jQuery); 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.