<script>
// hover停止动画
jQuery("#main .roll-img").hover(function(){
clearInterval(_internal);
});
jQuery("#main .roll-img").mouseleave(function(){
changImgTask(3000);
});
// 获取id对应的资源用:$(id_name)
var btnArr = new Array();btnArr[0] = $(rollbtn1);
btnArr[1] = $(rollbtn2);
btnArr[2] = $(rollbtn3);
btnArr[3] = $(rollbtn4);
var index = 0;
var i = 0;
// 定义函数用于滚动图片
function showRollImg(cur_n, next_n){
clearInterval(_internal);
var cur_element = jQuery("#rollimg .roll-img").eq(cur_n);
var next_element = jQuery("#rollimg .roll-img").eq(next_n);
cur_element.fadeOut(1000);
next_element.fadeIn(1000);
changImgTask(3000);
}
// 定义显示逻辑
function changeImg(){
console.log(index);
showRollImg(index, (index + 1) % 4);
if(index < 3) {
index++;
} else {
index = 0;
}
//document.getElementById("rollimg").src=picArr[index];
i = 0;
while(i<=3) {
if(i == index) {
btnArr[i].css("background-position","0 0");
} else {
btnArr[i].css("background-position","30px 0");
}
i++;
}
console.log(index);
}
// 定义定时任务
function changImgTask(timeSapn){_internal = window.setInterval("changeImg()", timeSapn);
}
changImgTask(3000);
$(vbtn).hover(function(){
document.getElementById("vbtn").src="${static_ctx}/images/img/main/bigV-hover.png";
});
$(vbtn).mouseleave(function(){
document.getElementById("vbtn").src="${static_ctx}/images/img/main/bigV.png";
});
$(rollleft).hover(function(){
document.getElementById("rollLeftImg").src="${static_ctx}/images/img/main/roll_left-hover.png";
});
$(rollleft).mouseleave(function(){
document.getElementById("rollLeftImg").src="${static_ctx}/images/img/main/roll_left.png";
});
$(rollright).hover(function(){
document.getElementById("rollRightImg").src="${static_ctx}/images/img/main/roll_right-hover.png";
});
$(rollright).mouseleave(function(){
document.getElementById("rollRightImg").src="${static_ctx}/images/img/main/roll_right.png";
});
$(rollleft).click(function(){
showRollImg(index, (index -1 + 4) % 4);
if(index > 0) {
index--;
} else {
index = 3;
}
i = 0;
while(i<=3) {
if(i == index) {
btnArr[i].css("background-position","0 0");
} else {
btnArr[i].css("background-position","30px 0");
}
i++;
}
});
$(rollright).click(function(){
showRollImg(index, (index + 1) % 4);
if(index < 3) {
index++;
} else {
index = 0;
}
i = 0;
while(i<=3) {
if(i == index) {
btnArr[i].css("background-position","0 0");
} else {
btnArr[i].css("background-position","30px 0");
}
i++;
}
});
$(rollbtn1).click(function(){
showRollImg(index, 0);
index = 0;
$(rollbtn1).css("background-position","0 0");
$(rollbtn2).css("background-position","30px 0");
$(rollbtn3).css("background-position","30px 0");
$(rollbtn4).css("background-position","30px 0");
});
$(rollbtn2).click(function(){
showRollImg(index, 1);
index = 1;
$(rollbtn2).css("background-position","0 0");
$(rollbtn1).css("background-position","30px 0");
$(rollbtn3).css("background-position","30px 0");
$(rollbtn4).css("background-position","30px 0");
});
$(rollbtn3).click(function(){
showRollImg(index, 2);
index = 2;
$(rollbtn3).css("background-position","0 0");
$(rollbtn2).css("background-position","30px 0");
$(rollbtn1).css("background-position","30px 0");
$(rollbtn4).css("background-position","30px 0");
});
$(rollbtn4).click(function(){
showRollImg(index, 3);
index = 3;
$(rollbtn4).css("background-position","0 0");
$(rollbtn2).css("background-position","30px 0");
$(rollbtn3).css("background-position","30px 0");
$(rollbtn1).css("background-position","30px 0");
});
$(document).ready(function(){
$(codediv).hover(function(){
document.getElementById("codeimg").src="${static_ctx}/images/img/main/get-code-hover.png";
});
$(codediv).mouseleave(function(){
document.getElementById("codeimg").src="${static_ctx}/images/img/main/get-code.png";
});
});
</script>
<script>
var picCount = new Array();
picCount[0] = "${static_ctx}/images/img/feature/Num0.png";
picCount[1] = "${static_ctx}/images/img/feature/Num1.png";
picCount[2] = "${static_ctx}/images/img/feature/Num2.png";
picCount[3] = "${static_ctx}/images/img/feature/Num3.png";
picCount[4] = "${static_ctx}/images/img/feature/Num4.png";
picCount[5] = "${static_ctx}/images/img/feature/Num5.png";
picCount[6] = "${static_ctx}/images/img/feature/Num6.png";
picCount[7] = "${static_ctx}/images/img/feature/Num7.png";
picCount[8] = "${static_ctx}/images/img/feature/Num8.png";
picCount[9] = "${static_ctx}/images/img/feature/Num9.png";
picCorner = "${static_ctx}/images/img/feature/corner.png";
</script>
<script>
function startmarquee(lh,speed,delay) {
var pHover = false;
var tInternal;
var oItems=document.getElementById("cmt-items");
oItems.innerHTML += oItems.innerHTML;
oItems.style.marginTop = 0;
oItems.onmouseover = function() {
pHover = true;
}
oItems.onmouseout = function() {
pHover = false;
}
function start(){
tInternal=setInterval(scrolling, speed);
if(!pHover) {
oItems.style.marginTop = parseInt(oItems.style.marginTop) - 1 + "px";
}
}
function scrolling(){
if(parseInt(oItems.style.marginTop) % lh != 0) {
oItems.style.marginTop = parseInt(oItems.style.marginTop) - 1 + "px";
if(Math.abs(parseInt(oItems.style.marginTop)) >= oItems.scrollHeight/2) {
oItems.style.marginTop = 0;
}
} else {
clearInterval(tInternal);
setTimeout(start, delay);
}
}
setTimeout(start, delay);
}
startmarquee(30,30,1500);
</script>