Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript fullpagejs悬停时暂停_Javascript_Setinterval_Fullpage.js - Fatal编程技术网

Javascript fullpagejs悬停时暂停

Javascript fullpagejs悬停时暂停,javascript,setinterval,fullpage.js,Javascript,Setinterval,Fullpage.js,js和我想在鼠标悬停在h1标记上时暂停滑块,但没有,我知道javascript有问题,但我无法让它工作 $(document).ready(function() { $('#fullpage').fullpage({ sectionsColor: ['#1bbc9b', '#4BBFC3'], loopBottom: true, afterRender: function() { setInterval(funct

js和我想在鼠标悬停在h1标记上时暂停滑块,但没有,我知道javascript有问题,但我无法让它工作

$(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 );
});
}))

尝试在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();
    });
使用bool的非常简单的方法(可能不是最清晰的):

var go = true;

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

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


谢谢,但是我得到了以下错误引用错误:slideSwitch没有定义你可以用相同的方式提到你的html吗?谢谢,但是我得到了以下错误引用错误:slideSwitch没有定义你可以用相同的方式提到你的html吗?我得到了以下错误:-引用错误:计时器没有定义-引用错误:StartSettings没有定义你能用工作版本更新小提琴吗?抱歉,我没有解释您必须添加的位置:)这是我得到的小提琴,错误如下:-ReferenceError:未定义计时器-ReferenceError:未定义StartSiterVal。。你能用工作版本更新小提琴吗?对不起,我没有解释你必须在哪里加:)这是小提琴