Skip to content

Commit

Permalink
Implements functions to use mouseover/out
Browse files Browse the repository at this point in the history
Implements functions to use jquery's mouseover/mouseout.
Now you can use like this:

$('#wrapper').scrollbox({
    linear: true,
    delay: 0,
    speed: 60,
    autoplay: false,
    onMouseOverPause: false
});
 
$('#forward-arrow').mouseover(function () {
    $('#wrapper').trigger('forwardHover');
}).mouseout(function(){
    $('#wrapper').trigger('pauseHover');
});

Thanks.
  • Loading branch information
rhenann committed Mar 8, 2014
1 parent a7d1d77 commit 536e70c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions jquery.scrollbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ $.fn.scrollbox = function(config) {
clearInterval(scrollingId);
scrollingId = setInterval(scrollForward, config.speed);
};

// Implements mouseover function.
forwardHover = function() {
paused = false;
clearInterval(scrollingId);
scrollingId = setInterval(scrollForward, config.speed);
};
pauseHover = function() {
paused = true;
};

backward = function() {
clearInterval(scrollingId);
Expand All @@ -161,6 +171,8 @@ $.fn.scrollbox = function(config) {
// bind events for container
container.bind('resetClock', function(delay) { resetClock(delay); });
container.bind('forward', function() { clearTimeout(nextScrollId); forward(); });
container.bind('pauseHover', function() { pauseHover(); });
container.bind('forwardHover', function() { forwardHover(); });
container.bind('backward', function() { clearTimeout(nextScrollId); backward(); });
container.bind('speedUp', function(speed) {
if (typeof speed === 'undefined') {
Expand Down

0 comments on commit 536e70c

Please sign in to comment.