1(function( $ ) { 2 $.fn.goTo = function() { 3 var element = this.first(), 4 $window = $(window), 5 winTop = $window.scrollTop(), 6 winHeight = $window.height(), 7 winBottom = winTop + winHeight, 8 elemTop = element.offset().top, 9 elemHeight = element.outerHeight(), 10 elemBottom = elemTop + elemHeight, 11 target = null; 12 13 if( winTop > elemTop ) { 14 // element pretika nahore 15 target = elemTop; 16 } else { 17 if( winBottom < elemBottom ) { 18 // element pretika dole 19 if( elemHeight >= winHeight ) { 20 //nevleze se to tam 21 target = elemTop; 22 } else { 23 target = elemBottom - winHeight; 24 } 25 } 26 } 27 if( null !== target ) { 28 $('html, body').animate({ 29 scrollTop: target + 'px' 30 }, 'fast'); 31 } 32 return element; 33 }; 34})( jQuery ); 35 36
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.