fullpage js在悬停时暂停

fullpagejs pause on hover

js,我想在鼠标悬停在 h1 标签上时暂停滑块,但它没有,我知道这是 javascript 的问题,但我无法使其工作

http://jsfiddle.net/2dhkR/405/

$(document).ready(function() {
    $('#fullpage').fullpage({
        sectionsColor: ['#1bbc9b', '#4BBFC3'],
        loopBottom: true,
        afterRender: function() {
            setInterval(function() {
                $.fn.fullpage.moveSlideRight();
            }, 3000);
        }
    });


    // the function - set var up just in case
    // the timer isn't running yet
    var timer = null;

    function startSetInterval() {
        timer = setInterval(showDiv, 5000);
    }
    // start function on page load
    startSetInterval();

    // hover behaviour
    function showDiv() {
        $('#fullpage h1').hover(function() {
            clearInterval(timer);
        }, function() {
            startSetInterval();
        });
    }

}); 

任何帮助将不胜感激,谢谢

尝试在 mouseenter 上使用 jQuery 的 hover(),然后在 mouseleave 上再次启动滑块。

$(function() {
var interval = setInterval( slideSwitch, 10000 );

$('#slideshow').hover(function() {
    clearInterval(interval);
}, function() {
    interval = setInterval( slideSwitch, 10000 );
});

});

使用 bool 的非常简单的方法(可能不是最清楚的):

var go = true;

if (go)$.fn.fullpage.moveSlideRight();

$('#fullpage h1').hover(function() {
        go = false;
        clearInterval(timer);
    }, function() {
        go = true;
        startSetInterval();
    });

http://jsfiddle.net/2dhkR/407/

var interval = undefined;
$(document).ready(function() {

    $('#fullpage').fullpage({
        sectionsColor: ['#1bbc9b', '#4BBFC3'],
        loopBottom: true,
        afterRender: function() {
           interval = setInterval(function() {
                $.fn.fullpage.moveSlideRight();
            }, 100);
        }
    });
  $('#fullpage h1').mouseover(function() {
    clearInterval(interval);
    interval = null;
  })
   $('#fullpage h1').mouseout(function() {
             interval = setInterval(function() {
                $.fn.fullpage.moveSlideRight();
            }, 100);
  });


}); // end document ready