【发布时间】:2011-06-07 01:36:24
【问题描述】:
有人可以帮帮我吗?在 jQuery 的其余部分构建元素列表之前,我需要隐藏 .jshowoff-link 元素。然后我在最后显示相同的元素。
它会在链接中生成一个图像列表。出于某种原因,它只显示第一个图像和链接,而不显示其他图像和链接。
我尝试交换 .show(); 函数的位置并将其添加到最后一个 if else 语句中,但这也不起作用。
这样做是为了在.jshowoff(); 函数触发之前停止显示图像和链接列表。
所以我完全没有想法。有人可以帮忙吗?
// hide banners to begin with
$ ('.jshowoff-link').hide();
// this function wraps the elements in the neccessary tags to work with anything Slider
$ (document).ready(function() {
$('a.jshowoff-link')
.wrap('<li class="jshowoff-slide"></li>');
$('li.jshowoff-slide')
.wrapAll('<ul id="jshowoff"></ul>');
// figures out if there's more than one <li> being produced
if (banners.length > 1) {
// if so, build the jshowoff
$('#jshowoff').jshowoff({speed:7000, changeSpeed:1000, autoPlay:true, controls:true, links:true, animatePause:false, hoverPause:false });
}
else {
// if not, disable the function
$('#jshowoff').jshowoff({speed:7000, changeSpeed:1000, autoPlay:false, controls:false, links:false, animatePause:false, hoverPause:false });
}
// show the jshowoff after it's been built to stop flash of content on slow internet connections
$('.jshowoff-link').show();
return false;
});
【问题讨论】:
-
我建议使用
live(),但我不确定可以使用哪种事件类型...
标签: jquery jquery-plugins jquery-selectors