[英]jQuery cycle plugin events
I have this jQuery code (which auto starts when the page loads) 我有这个jQuery代码(页面加载时自动启动)
$('#slideshow').cycle({
fx: 'scrollLeft',
timeout: 10,
speed: 10,
autostop: 3
});
I want the slides to start while clicking on the surrounding container my thought was: 我希望幻灯片在单击周围容器时开始播放,我的想法是:
$('#main-area').bind('click', function() {
$('#slideshow').cycle({
fx: 'scrollLeft',
timeout: 10,
speed: 10,
autostop: 3
});
});
However this does not work.. while if i change '#main-area' to document it works, but all the images are loaded vertical into the browser until I click on the document... should I rewrite a style:display:none; 但是这不起作用..如果我将'#main-area'更改为文档可以工作,但是所有图像都垂直加载到浏览器中,直到我单击该文档...我应该重写style:display:none ; or can this be fixed with a different approach easily? 还是可以轻松地用其他方法解决?
the html: HTML:
<div id="main-area">
<div id="slideshow" class="pics">
<img src="media/images/stuff.jpg" />
<img src="media/images/morestuff.jpg" />
<img src="media/images/stuffff.jpg" />
</div>
</div>
The plug in has a .pause()
method, try out starting the plug in and pausing it at page load, then when $("#main-area")
or $(document)
click event, use the .resume()
method, example here: 该插件有一个.pause()
方法,尝试启动该插件并在页面加载时暂停它,然后在$("#main-area")
或$(document)
click事件时,使用.resume()
方法,这里的示例:
http://jquery.malsup.com/cycle/pause.html http://jquery.malsup.com/cycle/pause.html
demo online: http://jsfiddle.net/tpak3/2/ 在线演示: http : //jsfiddle.net/tpak3/2/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.