From fba0f15df7dc2aa0d16ee0f61dabd8c7026ff7a7 Mon Sep 17 00:00:00 2001 From: Marcel Pol Date: Fri, 20 Mar 2020 12:33:47 +0100 Subject: [PATCH] Add pause on hover --- sss/sss.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sss/sss.js b/sss/sss.js index 705a9f4..aa0c7fe 100644 --- a/sss/sss.js +++ b/sss/sss.js @@ -47,6 +47,7 @@ $.fn.sss = function(options) { } function animate_slide(target) { + if ( $( wrapper ).hasClass( 'sss-hover' ) ) { reset_timer(); return; } if (!animating) { animating = true; var target_slide = slides.eq(target); @@ -99,10 +100,18 @@ $.fn.sss = function(options) { else if (key === 37) { prev_slide() } }); + $( wrapper ).hover( + function() { + $( wrapper ).addClass( 'sss-hover' ); + }, function() { + $( wrapper ).removeClass( 'sss-hover' ); + } + ); + }); // End }); }; -})(jQuery, window, document); \ No newline at end of file +})(jQuery, window, document);