Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.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幻灯片放映鼠标悬停在_Javascript_Html - Fatal编程技术网

Javascript幻灯片放映鼠标悬停在

Javascript幻灯片放映鼠标悬停在,javascript,html,Javascript,Html,下面是我的Javascript和Html幻灯片放映代码,可以自动启动幻灯片。现在,当鼠标悬停在幻灯片上时,我正试图开始这张幻灯片。但我不能。有可能吗?或者我该怎么做 Html标题部分Javascript代码: <link rel="stylesheet" href="css/global.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></sc

下面是我的Javascript和Html幻灯片放映代码,可以自动启动幻灯片。现在,当鼠标悬停在幻灯片上时,我正试图开始这张幻灯片。但我不能。有可能吗?或者我该怎么做

Html标题部分Javascript代码:

<link rel="stylesheet" href="css/global.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/slides.min.jquery.js"></script>
<script>
    $(function(){
        $('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true,
            animationStart: function(current){
                $('.caption').animate({
                    bottom:-35
                },100);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationStart on slide: ', current);
                };
            },
            animationComplete: function(current){
                $('.caption').animate({
                    bottom:0
                },200);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationComplete on slide: ', current);
                };
            },
            slidesLoaded: function() {
                $('.caption').animate({
                    bottom:0
                },200);
            }
        });
    });
</script>
<div id="container">
    <div id="example">          
        <div id="slides">
            <div class="slides_container">                
                <div class="slide">
<a href="#"><img src="img/slide-1.jpg" width="570" height="270" alt="Slide 
1"></a>             
                </div>
                <div class="slide">
<a href="#"><img src="img/slide-2.jpg" width="570" height="270" alt="Slide 
2"></a>                     
                </div>                      
            </div>              
        </div>
<img src="img/example-frame.png" width="739" height="341" alt="Example Frame" id="frame">
    </div>
</div>

$(函数(){
$(“#幻灯片”)。幻灯片({
预加载:正确,
预加载图像:“img/loading.gif”,
播放:5000,
暂停:2500,
悬停:是的,
animationStart:函数(当前){
$('.caption')。设置动画({
底部:-35
},100);
if(window.console&&console.log){
//返回当前幻灯片编号的示例
log('animationStart on slide:',当前);
};
},
动画完成:功能(当前){
$('.caption')。设置动画({
底部:0
},200);
if(window.console&&console.log){
//返回当前幻灯片编号的示例
log('animationComplete on slide:',当前);
};
},
slidesloadded:function(){
$('.caption')。设置动画({
底部:0
},200);
}
});
});
Html正文部分代码:

<link rel="stylesheet" href="css/global.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="js/slides.min.jquery.js"></script>
<script>
    $(function(){
        $('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true,
            animationStart: function(current){
                $('.caption').animate({
                    bottom:-35
                },100);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationStart on slide: ', current);
                };
            },
            animationComplete: function(current){
                $('.caption').animate({
                    bottom:0
                },200);
                if (window.console && console.log) {
                    // example return of current slide number
                    console.log('animationComplete on slide: ', current);
                };
            },
            slidesLoaded: function() {
                $('.caption').animate({
                    bottom:0
                },200);
            }
        });
    });
</script>
<div id="container">
    <div id="example">          
        <div id="slides">
            <div class="slides_container">                
                <div class="slide">
<a href="#"><img src="img/slide-1.jpg" width="570" height="270" alt="Slide 
1"></a>             
                </div>
                <div class="slide">
<a href="#"><img src="img/slide-2.jpg" width="570" height="270" alt="Slide 
2"></a>                     
                </div>                      
            </div>              
        </div>
<img src="img/example-frame.png" width="739" height="341" alt="Example Frame" id="frame">
    </div>
</div>

尝试命名你的函数(而不是匿名的
$(function(){…
),然后在你的一个div的
onmouseover
事件中(或“slides”或“example”或“container”)按名称调用它。

你在使用SlidesJS插件吗