0
後來,我爲需要編號活動狀態的客戶端實現了jCarousel圖像解決方案。經過一番搜索後找到了答案,但注意到首選的循環選項不起作用。jCarousel - 實現活動狀態幷包裝:循環
會發生什麼情況是,一旦旋轉木馬已經遍歷所有(5)圖像,在返回到第一個圖像時,活動狀態將會丟失,因爲根據jcarousel它實際上是第6個不斷增加)。
我只是繼續前進,而是用wrap:'both',它至少有一個正常工作的活動狀態。但是現在客戶說他們不喜歡這種效果,只想讓動畫在最終圖像後返回到位置1。這意味着我需要得到'wrap':'都'以某種方式工作。
下面是我目前的代碼。有人可以解決這個問題,因爲它有點高於我的頭!
function highlight(carousel, obejctli,liindex,listate){
jQuery('.jcarousel-control a:nth-child('+ liindex +')').attr("class","active");
};
function removehighlight(carousel, obejctli,liindex,listate){
jQuery('.jcarousel-control a:nth-child('+ liindex +')').removeAttr("class","active");
};
jQuery('#mycarousel').jcarousel({
initCallback: mycarousel_initCallback,
auto: 5,
wrap: 'both',
vertical: true,
scroll: 1,
buttonNextHTML: null,
buttonPrevHTML: null,
animation: 1000,
itemVisibleInCallback: highlight,
itemVisibleOutCallback: removehighlight
});
});
在此先感謝
感謝Duopixel。我把這一個交給了一位同事,她提出了和你一樣的答案。 乾杯。 – swisstony 2011-02-13 08:13:35