单击Javascript滑块下方的按钮,将其暂停几秒钟
我已经下载了滑块代码。我正在使用上面链接中的演示代码。我的要求是,当我点击滑块下方的单选按钮时,我需要滑块暂停几秒钟(对我来说是10秒)。默认间隔是2.6秒 我曾尝试使用jQueryOnClick更改时间间隔,但它不起作用 下面是我的html代码单击Javascript滑块下方的按钮,将其暂停几秒钟,javascript,jquery,slider,slideshow,Javascript,Jquery,Slider,Slideshow,我已经下载了滑块代码。我正在使用上面链接中的演示代码。我的要求是,当我点击滑块下方的单选按钮时,我需要滑块暂停几秒钟(对我来说是10秒)。默认间隔是2.6秒 我曾尝试使用jQueryOnClick更改时间间隔,但它不起作用 下面是我的html代码 <div id="sliderFrame"> <div id="slider"> <img src="images/image-slider-1.jpg" /> <img
<div id="sliderFrame">
<div id="slider">
<img src="images/image-slider-1.jpg" />
<img src="images/image-slider-2.jpg" />
<img src="images/image-slider-3.jpg" />
<img src="images/image-slider-4.jpg" />
<img src="images/image-slider-5.jpg" />
</div>
</div>
我尝试在另一个函数中将pausetime更改为10000,该函数在单击单选按钮后执行。代码如下
<script type="text/javascript">
$("document").ready(function(){
$(".active").click(function(){
alert("hi");
var sliderOptions=
{
sliderId: "slider",
startSlide: 0,
effect: "series1",
effectRandom: false,
pauseTime: 10000,
transitionTime: 500,
slices: 12,
boxes: 8,
hoverPause: 1,
autoAdvance: true,
captionOpacity: 0.3,
captionEffect: "fade",
thumbnailsWrapperId: "thumbs",
m: false,
license: "mylicense"
};
})
var imageSlider=new mcImgSlider(sliderOptions);
})
</script>
$(“文档”).ready(函数(){
$(“.active”)。单击(函数(){
警报(“hi”);
变量滑块选项=
{
sliderId:“滑块”,
开始滑动:0,
效果:“系列1”,
结果:错,
暂停时间:10000,
过渡时间:500,
片数:12,
信箱:8,
暂停:1,,
自动推进:是的,
字幕容量:0.3,
字幕效果:“褪色”,
thumbnailsWrapperId:“拇指”,
m:错,
许可证:“mylicense”
};
})
var imageSlider=新的mcImgSlider(滑动选项);
})
是否有人可以帮助我如何实现此功能。请检查Menucool支持的滑块库
pauseTime选项将仅用于mouseout和mouseover事件
为了满足您的需求,您必须使用“switchAuto”功能
这是你的电话号码
Javascript:
$("#changeInterval").change(function(){
var that = this;
if(this.checked && imageSlider.getAuto()) {
imageSlider.switchAuto(); // pause the animation (auto: false)
setTimeout(function(){
that.checked = false; // uncheck the radio button
imageSlider.switchAuto(); // resume the animation (auto: true)
}, 10000); // 10 seconds
}
});
在上面的代码中,我在单选按钮(id:changeInterval)上绑定“change”事件
默认情况下,在选项列表中,auto值已设置为true,因此当我们调用“switchAuto”函数时,它会将auto值更改为false,从而停止动画。10秒后,我再次调用“switchAuto”功能来恢复动画
通过这种方式,可以将动画暂停指定的时间
$("#changeInterval").change(function(){
var that = this;
if(this.checked && imageSlider.getAuto()) {
imageSlider.switchAuto(); // pause the animation (auto: false)
setTimeout(function(){
that.checked = false; // uncheck the radio button
imageSlider.switchAuto(); // resume the animation (auto: true)
}, 10000); // 10 seconds
}
});