有人可以幫我嗎?在jQuery的其餘部分構建元素列表之前,我需要隱藏.jshowoff-link
元素。然後我在最後顯示相同的元素。jQuery .show();函數不顯示以前隱藏的所有元素
它生成鏈接中的圖像列表。出於某種原因,雖然它只顯示第一個圖像和鏈接,而不是其他的。
我試過交換.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;
});
我建議使用[`活()`](HTTP://api.jquery。 com/live /),但我不確定可以使用哪種事件類型...... – 2011-01-11 10:53:13