Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Excluded" option #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions SmoothScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ function init() {
activeElement = body;

initTest();

if ('string' == typeof options.excluded && 0 < options.excluded.length) {
options.excluded = document.body.querySelectorAll(options.excluded);
}

// Checks if this script is running in a frame
if (top != self) {
Expand Down Expand Up @@ -301,6 +305,14 @@ function wheel(event) {
var target = event.target;
var overflowing = overflowingAncestor(target);

if('object' == typeof options.excluded && 0 < options.excluded.length) {
for(var i = 0; i < options.excluded.length; i++) {
if(overflowing == options.excluded[i]) {
return true;
}
}
}

// use default if there's no overflowing
// element or default action is prevented
// or it's a zooming event with CTRL
Expand Down