_dotContainer.className = 'CreabineCarousel-dotContainer';
_root.appendChild(_dotContainer);
for (var i = 0; i < imgPathList.length; i++) {
var _dot = document.createElement("li");
_dot.className = "dot";
_dot.id = "item" + (i+1) + "dot";
_dotContainer.appendChild(_dot);
var _item = document.createElement("p");
_item.className = "CreabineCarousel-item"
_item.id = "item" + (i+1);
_item.style.backgroundImage = "url(" + imgPathList[i] + ")";
_item.style.backgroundSize = "cover";
_item.style.backgroundRepeat = "no-repeat";
if(i == 0){
_item.style.opacity = '0';
_item.style.zIndex = '1';
}
_root.appendChild(_item);
var _h = document.createElement("h1");
_h.innerText = textList[i].title;
_item.appendChild(_h);
var _p = document.createElement("p");
_p.innerText = textList[i].text;
_item.appendChild(_p);
}
_dotContainer.addEventListener("mouseover",function(e){
if( e.target && e.target.className == "dot" ){
clearInterval(timer);
var id = e.target.id.substring(0,5);
CarouselHover(id);
}
});
_dotContainer.addEventListener("mouseout",function(e){
if( e.target && e.target.className == "dot" ){
var id = e.target.id;
CarouselOut(id);
}
});
if(_autoScroll){
timer = setInterval(function(){Carousel()},_scrollDuration);
}
}
function Carousel(){
var all = document.getElementsByClassName('CreabineCarousel-item');
for (var i = all.length - 1; i >= 0; i--) {
all[i].style.opacity = '0';
all[i].style.zIndex = '1';
}
var i=((changeCount++%5)+1);
var id = "item" + i;
document.getElementById(id) 。style.opacity = '1';
document.getElementById(id) 。style.zIndex = '10';
}
function CarouselHover(id){
clearInterval(timer);
var all = document.getElementsByClassName('CreabineCarousel-item');
for (var i = all.length - 1; i >= 0; i--) {
all[i].style.opacity = '0';
all[i].style.zIndex = '1';
}
document.getElementById(id) 。style.opacity = '1';
document.getElementById(id) 。style.zIndex = '10';
}
function CarouselOut(id){
var num = id.substring(4,5);
num = parseInt(num)-1;
changeCount = num;
timer = window.setInterval(function(){Carousel()},_scrollDuration);
}
initElements();
new CreabineCarousel({
root:'carouselRoot',
推荐阅读
- AsyncTask的三个属性值和四个步骤
- 建设商城类的网站应做好五个方面
- 2017 年网页设计的十大趋势
- 关于待机图片制作和修改的几点经验
- 伤口引流管拔出很痛怎么办 拔伤口上的引流管疼吗?
- 女性大肠癌的早期症状? 女性大肠癌的早期症状
- 胰十二指肠切除手术后注意哪些饮食 胰十二指肠切除术后的饮食
- 女性胃癌的早期症状后背疼怎么回事 女性胃癌的早期症状后背疼?
- 为什么玩083冒险岛在进下个地图的时候电脑自动关机?为
- 每天油脂类的摄入量不应超过每天油脂类的摄入量是多少