1function testTheiaStickySidebars() { 2 var me = {}; 3 me.scrollTopStep = 1; 4 me.currentScrollTop = 0; 5 me.values = null; 6 7 window.scrollTo(0, 1); 8 window.scrollTo(0, 0); 9 10 $(window).scroll(function(me) { 11 return function(event) { 12 var newValues = []; 13 14 // Get sidebar offsets. 15 $('.theiaStickySidebar').each(function() { 16 newValues.push($(this).offset().top); 17 }); 18 19 if (me.values != null) { 20 var ok = true; 21 22 for (var j = 0; j < newValues.length; j++) { 23 var diff = Math.abs(newValues[j] - me.values[j]); 24 if (diff > 1) { 25 ok = false; 26 27 console.log('Offset difference for sidebar #' + (j + 1) + ' is ' + diff + 'px'); 28 29 // Highlight sidebar. 30 $($('.theiaStickySidebar')[j]).css('background', 'yellow'); 31 } 32 } 33 34 if (ok == false) { 35 // Stop test. 36 $(this).unbind(event); 37 38 alert('Bummer. Offset difference is bigger than 1px for some sidebars, which will be highlighted in yellow. Check the logs. Aborting.'); 39 40 return; 41 } 42 } 43 44 me.values = newValues; 45 46 // Scroll to bottom. We don't cache ($(document).height() - $(window).height()) since it may change (e.g. after images are loaded). 47 if (me.currentScrollTop < ($(document).height() - $(window).height()) && me.scrollTopStep == 1) { 48 me.currentScrollTop += me.scrollTopStep; 49 window.scrollTo(0, me.currentScrollTop); 50 } 51 // Then back up. 52 else if (me.currentScrollTop > 0) { 53 me.scrollTopStep = -1; 54 me.currentScrollTop += me.scrollTopStep; 55 window.scrollTo(0, me.currentScrollTop); 56 } 57 // Then stop. 58 else { 59 $(this).unbind(event); 60 61 alert("Great success!"); 62 } 63 }; 64 }(me)); 65}
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.