Skip to content

Instantly share code, notes, and snippets.

@holly4
Last active July 4, 2016 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holly4/960a6dc481947fe7e13204d6d23a8e14 to your computer and use it in GitHub Desktop.
Save holly4/960a6dc481947fe7e13204d6d23a8e14 to your computer and use it in GitHub Desktop.
Control Scrolling on Fox Forum
// 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