X
印度全球藥房中文官網
www.ingpharma.com
-
$(function(){
var notice_index6 = 0;
var notice_autoTimer6 = 0;//全局變量目的實現左右點擊同步
//自動輪播
$(".notice-block6 ul li:eq(0)").clone(true).appendTo($(".notice-block6 ul"));//克隆第一個放到最后(實現無縫滾動)
var liHeight = $(".notice-block6").height();//一個li的高度
//獲取li的總高度再減去一個li的高度(再減一個Li是因為克隆了多出了一個Li的高度)
var totalHeight = ($(".notice-block6 ul li").length * $(".notice-block6 ul li").eq(0).height()) -liHeight;
$(".notice-block6 ul").height(totalHeight);//給ul賦值高度
notice_autoTimer6 = setInterval(function(){
notice_index6++;
if(notice_index6 > $(".notice-block6 ul li").length -1) {
notice_index6 = 0;
}
$(".notice-block6 ul").stop().animate({
top: -notice_index6 * liHeight
},500,function(){
if(notice_index6 == $(".notice-block6 ul li").length -1) {
$(".notice-block6 ul").css({top:0});
notice_index6 = 0;
}
});
},3000);
});