【发布时间】:2016-01-25 07:51:36
【问题描述】:
我有旋转木马(我认为它是由引导程序制成的),它是从 themeforest 的模板中派生的。在我想让它自动播放之前它运行良好。我试过设置interval:1000,但还是不行。这是脚本:
function InitPropertyCarousel() {
if ($('.carousel.property .content li img').length !== 0) {
$('.carousel.property .content li img').on({
click: function(e) {
var src = $(this).attr('src');
var img = $(this).closest('.carousel.property').find('.preview img');
img.attr('src', src);
$('.carousel.property .content li').each(function() {
$(this).removeClass('active');
});
$(this).closest('li').addClass('active');
}
});
}
}
这是示例链接:http://preview.byaviators.com/template/realia/detail.html。 (我尝试将此代码放在 jsfiddle 上,但它不起作用。)
【问题讨论】:
-
你可以在这篇帖子stackoverflow.com/questions/13525258/… ;) 中找到解决方案
-
感谢您的文字,但是您阅读了我的详细信息吗?代码完全不同,您的链接没有帮助:(
-
能让你成为小提琴吗?
-
你现在需要在你的函数上设置间隔。
setInterval(function(){ InitPropertyCarousel() }, 3000); -
是的,它会移动缩略图条。但它不会改变
preview类中的主照片。
标签: javascript jquery css twitter-bootstrap carousel