Content deleted Content added
add testing code (as remarks), for later use |
add window.scrolly and alert test |
||
Line 53:
// =================== Prep work =====================
var y1; var y2;
var annoSwitch;
var cont = document.getElementById('mw-content-text');
Line 83 ⟶ 84:
// is easier to follow.
// ============ Function to hide annotations ==============
function annoHide() {
// store status so it persists across page loads
Line 112 ⟶ 114:
//Scroll the window by the required amount
window.scrollBy(0, scroll_amount);
y1 = window.scrollY;
alert( "vertical scroll position is " + y1);
// now we have to update the menu item
Line 131 ⟶ 136:
}
// ============ Function to show annotations ==============
function annoShow() {
// store status so it persists across page loads
Line 151 ⟶ 157:
$( annoSwitch ).click( function ( e ) {
e.preventDefault();
window.scrollTo(0, y1);
annoHide();
} );
Line 158 ⟶ 165:
// </syntaxhighlight>
// window.scrollTo(0,
// y = window.scrollY;
// alert( "vertical scroll position is " + y);
|