1$.fn.visible = function(partial) { 2 var $t = $(this), 3 $w = $(window), 4 viewTop = $w.scrollTop(), 5 viewBottom = viewTop + $w.height(), 6 _top = $t.offset().top, 7 _bottom = _top + $t.height(), 8 compareTop = partial === true ? _bottom : _top, 9 compareBottom = partial === true ? _top : _bottom; 10 11 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 12 } 13 14 $(document).ready(function(e) { 15 checkVisiblePie(); 16 }); 17 18 $(window).scroll(function(e) { 19 checkVisiblePie(); 20 }); 21 22 function checkVisiblePie() { 23 if ($('.piechart').length) { 24 $('.js-progress-bar').each(function(i, k) { 25 if ($(this).visible()) { 26 var amount = $(k).attr('data-amount'); 27 var pieValue = 100-amount 28 $(k).css("stroke-dashoffset", ""+pieValue+"px"); 29 } else { 30 $(k).removeAttr('style'); 31 } 32 }); 33 } 34 35 } 36 37 38
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.