Last active
July 4, 2016 06:25
-
-
Save holly4/960a6dc481947fe7e13204d6d23a8e14 to your computer and use it in GitHub Desktop.
Control Scrolling on Fox Forum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// handlers to store original methods | |
scrollToProper = window.scrollTo; | |
scrollByProper = window.scrollBy; | |
// is scrolling enabled? | |
scrollEnabled = true; | |
// override the scollTo and scrollBy functions | |
window.scrollTo = function (x, y) { | |
if (scrollEnabled) | |
scrollToProper(x, y); | |
} | |
window.scrollByProper = function (x, y) { | |
if (scrollEnabled) | |
scrollByProper(x, y); | |
} | |
// create a new button to control scrolling | |
$('.fyre-editor').append('<a id="enableScoll" title="enableScoll">Scrolling Enabled</a>'); | |
var elem = $('#enableScoll'); | |
elem.css('background', '#00FFFF'); | |
elem.css('cursor', 'pointer'); | |
elem.css('border', 'solid 2px #eaeaea'); | |
elem.css('padding', '2'); | |
// set handler for the button click | |
elem.click(function () { | |
scrollEnabled = !scrollEnabled; | |
if (scrollEnabled) { | |
$(this).css('background', '#00FFFF'); | |
$(this).text('Scrolling Enabled'); | |
} else { | |
$(this).css('background', '#F0FFFF'); | |
$(this).text('Scrolling Disabled'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment