var issupporttouch = $(window).width() <= 1024;
(function ($) {
//无图图像
var nullimg = 'images/error.png';
function lod(t) {
t.onerror = null;
t.src = nullimg
}
$(function () {
$(".ratio-img").each(function () {
if ($(this).attr("src") == "") {
$(this).attr({ "src": nullimg })
}
})
})
$(function () {
if ($(".phone_menu").is(":visible")) {
$(".banner_index li").each(function (i) {
$(".banner_index li:eq(" + i + ") img").attr("src", $(".banner_index li:eq(" + i + ") img").data("img"));
})
try{
$(".banner_index ul").bxslider({
});
} catch (e) { }
} else {
var dotcount = 0;
var dotclickcount = 0;
var bannertimer = null;
var bannertimeout = null;
var movetime = 6000;
var movespeed = 1500;
var bannersize = $(".banner_index_new li").size();
var movelength = $(window).width();
var dir = 1;
$(window).resize(function () {
movelength = $(window).width();
$(".banner_index_new,.banner_index").height(movelength * 0.36969696);
$(".banner_index_new li").css({ "width": $(".banner_index_new").width(), "float": "left", "position": "absolute" });
$(".banner_index_new ul").css({ "width": $(".banner_index_new").width() * bannersize, "overflow": "hidden", "position": "relative" });
})
$(window).resize();
$(".banner_index_new").append('');
$(".banner_index_new").append('
');
for (var i = 0; i < $(".banner_index_new li").size() ; i++) {
$(".banner_index_new dl").append('');
}
$(".banner_index_new dl dd:first").addclass("active");
$(".banner_index_new li").eq(0).addclass("curr");
$(document).on("click", ".banner_index_new dl dd", function () {
var nindex = $(".banner_index_new dl dd").index(this);
if (!$(".banner_index_new ul").is(":animated") && $(".banner_index_new ul li:eq(" + nindex + ")").find("video").size() == 0) {
clearinterval(bannertimer);
$(".banner_index_new li.banner_video video").remove();
dotclickcount = nindex;
if (nindex > dotcount) {
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": movelength });
$(".banner_index_new ul").stop().animate({ "left": movelength * -1 }, 1000, function () {
$(".banner_index_new li").css({ "left": 0 }).removeclass("curr");
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": 0 }).addclass("curr");
$(".banner_index_new ul").css({ "left": 0 });
});
dotcount = nindex;
} else if (nindex < dotcount) {
$(".banner_index_new ul").css({ "left": movelength * -1 });
$(".banner_index_new li").css({ "left": 0 }).removeclass("curr");
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": 0 }).addclass("curr");
$(".banner_index_new li:eq(" + dotcount + ")").css({ "left": movelength });
$(".banner_index_new ul").stop().animate({ "left": 0 }, 1000, function () {
$(".banner_index_new li").css({ "left": 0 }).removeclass("curr");
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": 0 }).addclass("curr");
$(".banner_index_new ul").css({ "left": 0 });
});
dotcount = nindex;
}
$(".banner_index_new dl dd:eq(" + nindex + ")").removeclass("actove").addclass("active").siblings().removeclass();
if ($(".banner_index_new li:eq(" + nindex + ")").hasclass("banner_video")) {
$(".banner_index_new li:eq(" + nindex + ")").append("")
document.getelementbyid("media_banner").play();
settimeout(function () {
movetime = (document.getelementbyid("media_banner").duration - 1) * 1000;
bannertimer = setinterval(function () {
$(".banner_right").click();
settimeout(function () {
$(".banner_index_new li:eq(" + nindex + ")").siblings().find("video").remove();
}, 1000)
}, movetime)
}, 1000)
} else {
movetime = 6000;
bannertimer = setinterval(function () {
$(".banner_right").click();
}, movetime)
}
}
})
//{ easing: 'easeinquint', duration: 600 }
if ($(".banner_index_new li").size() > 1) {
$(".banner_right").on("click", function () {
if (!$(".banner_index_new ul").is(":animated")) {
clearinterval(bannertimer);
dir = 1;
if (dotclickcount >= bannersize - 1) {
dotclickcount = 0;
right_click(dotclickcount);
} else {
dotclickcount++;
right_click(dotclickcount);
}
}
})
$(".banner_left").on("click", function () {
if (!$(".banner_index_new ul").is(":animated")) {
clearinterval(bannertimer);
dir = 0;
if (dotclickcount <= 0) {
dotclickcount = bannersize - 1;
left_click(dotclickcount);
} else {
dotclickcount--;
left_click(dotclickcount);
}
}
})
}
function right_click(nindex) {
$(".banner_index_new li.banner_video video").remove();
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": movelength });
$(".banner_index_new ul").stop().animate({ "left": movelength * -1 }, 1000, function () {
$(".banner_index_new li").css({ "left": 0 }).removeclass("curr");
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": 0 }).addclass("curr");
$(".banner_index_new ul").css({ "left": 0 });
});
dotcount = nindex;
$(".banner_index_new dl dd:eq(" + nindex + ")").removeclass("actove").addclass("active").siblings().removeclass();
if ($(".banner_index_new li:eq(" + nindex + ")").hasclass("banner_video")) {
$(".banner_index_new li:eq(" + nindex + ")").append("")
document.getelementbyid("media_banner").play();
settimeout(function () {
movetime = (document.getelementbyid("media_banner").duration - 1) * 1000;
bannertimer = setinterval(function () {
$(".banner_right").click();
}, movetime)
}, 1000)
} else {
movetime = 6000;
bannertimer = setinterval(function () {
$(".banner_right").click();
}, movetime)
}
}
function left_click(nindex) {
$(".banner_index_new li.banner_video video").remove();
$(".banner_index_new ul").css({ "left": movelength * -1 });
$(".banner_index_new li").css({ "left": 0 }).removeclass("curr");
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": 0 }).addclass("curr");
$(".banner_index_new li:eq(" + dotcount + ")").css({ "left": movelength });
$(".banner_index_new ul").stop().animate({ "left": 0 }, 1000, function () {
$(".banner_index_new li").css({ "left": 0 }).removeclass("curr");
$(".banner_index_new li:eq(" + nindex + ")").css({ "left": 0 }).addclass("curr");
$(".banner_index_new ul").css({ "left": 0 });
});
dotcount = nindex;
$(".banner_index_new dl dd:eq(" + nindex + ")").removeclass("actove").addclass("active").siblings().removeclass();
//part_video
if ($(".banner_index_new li:eq(" + nindex + ")").hasclass("banner_video")) {
$(".banner_index_new li:eq(" + nindex + ")").append("")
document.getelementbyid("media_banner").play();
settimeout(function () {
movetime = (document.getelementbyid("media_banner").duration - 1) * 1000;
bannertimer = setinterval(function () {
$(".banner_right").click();
}, movetime)
}, 1000)
} else {
movetime = 6000;
bannertimer = setinterval(function () {
$(".banner_right").click();
}, movetime)
}
}
bannertimer = setinterval(function () {
$(".banner_right").click();
}, movetime)
}
})
})(jquery);