Skip to content

Commit

Permalink
- Implemented autoScrollingPauseOnHover option to allow auto scrollin…
Browse files Browse the repository at this point in the history
…g to pause/unpause on mouseover
  • Loading branch information
fromthecove committed Jan 23, 2015
1 parent 1c3b3a6 commit d9c8b6d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,9 +1,10 @@
.DS_Store
.DS_Store?
._*
.idea
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
testpage.html
DebugNotes.txt
DebugNotes.txt
22 changes: 22 additions & 0 deletions js/source/jquery.smoothDivScroll-1.3.js
Expand Up @@ -72,6 +72,7 @@
autoScrollingDirection: "endlessLoopRight", // right, left, backAndForth, endlessLoopRight, endlessLoopLeft String
autoScrollingStep: 1, // Pixels
autoScrollingInterval: 10, // Milliseconds
autoScrollingPauseOnHover: false,

// Touch scrolling
touchScrolling: false,
Expand Down Expand Up @@ -160,6 +161,7 @@
el.data("enabled", true);
el.data("scrollableAreaHeight", el.data("scrollableArea").height());
el.data("scrollerOffset", el.offset());
el.data('autoscrollingWasRunning',false);

/*****************************************
SET UP EVENTS FOR TOUCH SCROLLING
Expand Down Expand Up @@ -194,6 +196,25 @@
});
}

/*****************************************
SET UP EVENTS FOR AUTOSCROLL PAUSING
*****************************************/
// Mouseover scrollWrapper
el.data("scrollWrapper").bind("mouseover", function () {
if (o.autoScrollingPauseOnHover && el.data("autoScrollingInterval") !== null) {
// Stop any ongoing auto scrolling
self.stopAutoScrolling();
}
});

// Mouseout scrollWrapper
el.data("scrollWrapper").bind("mouseout", function () {
if (o.autoScrollingPauseOnHover && el.data('autoscrollingWasRunning')) {
// Stop any ongoing auto scrolling
self.startAutoScrolling();
}
});

/*****************************************
SET UP EVENTS FOR SCROLLING RIGHT
*****************************************/
Expand Down Expand Up @@ -1108,6 +1129,7 @@

if (el.data("autoScrollingInterval") !== null) {
clearInterval(el.data("autoScrollingInterval"));
el.data("autoscrollingWasRunning", true);
el.data("autoScrollingInterval", null);

// Check to see which hotspots should be active
Expand Down

0 comments on commit d9c8b6d

Please sign in to comment.