// javascript document
$(function(){
(function(){
var mouseoverflag = false,
index = 0,
interval,
timeout,
stoptime = 5000,
animatetime = 500,
leftele = $(".slide > ul", "#imagetoggle"),
leftelewidth = leftele.children("li").outerwidth(),
rightele = $(".trum > ul", "#imagetoggle"),
righteleheight = rightele.children("li").outerheight(true),
lilength = rightele.children("li").length,
intervalfunc = function(num){
cleartimeout(timeout);
if(typeof num == "number"){
index = num;
} else {
index++;
}
leftele.stop().animate({
"marginleft" : (-1) * index * leftelewidth + "px"
},animatetime);
if(index >= lilength - 1){
clearinterval(interval);
cleartimeout(timeout);
$("#imagetoggle .next").addclass("disnext");
$("#imagetoggle .prev").removeclass("disprev");
if(!mouseoverflag){
timeout = settimeout(function(){
index = 0;
$("#imagetoggle .prev").addclass("disprev");
$("#imagetoggle .next").removeclass("disnext");
rightele.css("margintop", "0px");
leftele.css("marginleft", "0px");
rightele.children("li:eq("+index+")").addclass("curr").siblings().removeclass("curr");
interval = setinterval(intervalfunc,stoptime);
},5000);
}
} else if(index <= 0){
if(index == 0){
$("#imagetoggle .prev").addclass("disprev");
$("#imagetoggle .next").removeclass("disnext");
} else {
$("#imagetoggle .prev").removeclass("disprev");
$("#imagetoggle .next").removeclass("disnext");
}
rightele.stop().animate({
"margintop" : (-1) * index * righteleheight + "px"
},animatetime,function(){
var width = parsefloat(leftele.css("width"));
if(width < (index+5)*leftelewidth){
leftele.css("width", (index+5)*leftelewidth + "px");
var appendhtml = [];
for(var i = leftele.children("li").length; i < (index+5) && i < lilength; i++){
var currele = rightele.children("li:eq("+i+")").children("img"),
srcdata = currele.attr("data-src"),
titledata = currele.attr("data-title"),
infodata = currele.attr("data-info");
appendhtml.push('
',
' ',
' ',
' ',
'
',titledata,'
',
'
',infodata,'
',
'
',
' ',
'');
}
leftele.append(appendhtml.join(""));
}
});
} else {
rightele.stop().animate({
"margintop" : (-1) * (lilength - 4) * righteleheight + "px"
},animatetime,function(){
var width = parsefloat(leftele.css("width"));
if(width < (index+5)*leftelewidth){
leftele.css("width", (index+5)*leftelewidth + "px");
var appendhtml = [];
for(var i = leftele.children("li").length; i < (index+5) && i < lilength; i++){
var currele = rightele.children("li:eq("+i+")").children("img"),
srcdata = currele.attr("data-src"),
titledata = currele.attr("data-title"),
infodata = currele.attr("data-info");
appendhtml.push('',
' ',
' ',
' ',
'
',titledata,'
',
'
',infodata,'
',
'
',
' ',
'');
}
leftele.append(appendhtml.join(""));
}
});
$("#imagetoggle .prev").removeclass("disprev");
$("#imagetoggle .next").removeclass("disnext");
}
rightele.children("li:eq("+index+")").addclass("curr").siblings().removeclass("curr");
};
leftele.css("width", leftelewidth * 4 + "px");
interval = setinterval(intervalfunc,stoptime);
$("#imagetoggle").hover(function(){
clearinterval(interval);
cleartimeout(timeout);
mouseoverflag = true;
},function(){
cleartimeout(timeout);
timeout = settimeout(function(){
if(index >= lilength - 1){
intervalfunc(index);
} else {
interval = setinterval(intervalfunc,stoptime);
}
},5000);
mouseoverflag = false;
});
rightele.children("li").hover(function(){
if($(this).closest("li").hasclass("curr")){
return;
}
$(this).find("i").stop().css("left","-164px").animate({
"left" : "6px"
},199);
},function(){
$(this).find("i").stop().animate({
"left" : "170px"
},199,function(){
$(this).css("left","");
});
}).bind("click",function(event){
event.stoppropagation();
if($(this).hasclass("curr")){
return ;
}
var index = $(this).index();
intervalfunc(index);
}).children("a").bind("click",function(event){
event.preventdefault();
});
$(".prev","#imagetoggle").bind("click",function(){
if($(this).hasclass("disprev")){
return;
}
index--;
intervalfunc(index);
});
$(".next","#imagetoggle").bind("click",function(){
if($(this).hasclass("disnext")){
return;
}
intervalfunc();
});
})()
});
$(function(){
(function(){
var index = 0,
interval,
toggleele = $(".dropdown > ul"),
lilength = toggleele.children("li").length,
liheight = toggleele.children("li").outerheight(true),
intervalfunc = function(num){
if(typeof num == "number"){
index = num;
} else {
index++;
}
toggleele.stop().animate({
"margintop" : (-1)*index*liheight + "px"
},499,function(){
if(index >= lilength){
index = 0;
toggleele.css("margintop","0px");
}
});
};
toggleele.children(":first").clone(true).appendto(toggleele);
interval = setinterval(intervalfunc, 2499);
toggleele.hover(function(){
clearinterval(interval);
},function(){
interval = setinterval(intervalfunc, 2499);
});
$(".tri > div").hover(function(){
if($(this).hasclass("up")){
$(this).addclass("upprev");
} else {
$(this).addclass("downnext");
}
},function(){
if($(this).hasclass("up")){
$(this).removeclass("upprev");
} else {
$(this).removeclass("downnext");
}
}).bind("click",function(){
if($(this).hasclass("up")){
clearinterval(interval);
if(index == 0){
index = lilength;
toggleele.css("margintop",(-1)*index*liheight + "px");
}
index--;
intervalfunc(index);
interval = setinterval(intervalfunc, 2499);
} else {
clearinterval(interval);
intervalfunc();
interval = setinterval(intervalfunc, 2499);
}
});
})()
})
$(function(){
(function(){
var index = 0,
interval,
toggleele = $(".bou-img > ul"),
leftele = $(".bou-img > .prev-left"),
rightele = $(".bou-img > .next-right"),
lilength = toggleele.children("li").length,
liwidth = toggleele.children("li").outerwidth(true),
intervalfunc = function(num){
if(typeof num == "number"){
index = num;
} else {
index++;
}
if(index > lilength){
index = 1;
toggleele.css("marginleft","0px");
}
toggleele.stop().animate({
"marginleft" : (-1)*index*liwidth + "px"
},499,function(){
if(index >= lilength){
index = 0;
toggleele.css("marginleft","0px");
}
});
};
toggleele.css("width", (lilength+1)*liwidth + "px").children(":first").clone(true).appendto(toggleele);
interval = setinterval(intervalfunc, 2499);
toggleele.parent().hover(function(){
clearinterval(interval);
leftele.stop().animate({
"left" : "0px"
},199);
rightele.stop().animate({
"right" : "0px"
},199);
},function(){
leftele.stop().animate({
"left" : "-22px"
},199);
rightele.stop().animate({
"right" : "-22px"
},199);
interval = setinterval(intervalfunc, 2499);
});
leftele.bind("click",function(event){
event.preventdefault();
event.stoppropagation();
if(index <= 0){
index = lilength;
toggleele.css("marginleft",(-1)*index*liwidth + "px");
}
index--;
intervalfunc(index);
});
rightele.bind("click",function(event){
event.preventdefault();
event.stoppropagation();
intervalfunc();
});
})()
})