
";
});
$(".mtucebg ul").html(html);
//设置显示文字
var $mtucebgLiIndex;
$(".mtucebg ul li").each(function(){
var $index=$(this).index()+1;
var liLen=$(".mtucebg ul li").length;
var liImg=$(this).find("img");
var aInitImg=$thisA.parents(".atlasWrap3,.atlasWrap4,.atlasWrap5").length == 0 ? $thisA.find("img").attr("src") : $thisA.css("background-image").replace(/\"|\(|\)|url/g, '')
$(this).append("
" + $index + "/" + liLen + "")
if(liImg.attr("src").indexOf(aInitImg)!=-1){
$mtucebgLiIndex=$(this).index()+1;
};
});
var sonLen = $(".mtucebg ul li").length;
$(".mtucebg").show().find("#mScrollerShow").css({
"width": sonLen * $(window).width(),
}).find("li").css({
width: screenWid,
height: screenHei,
"text-align": "center",
}).find("img").css({
"max-width": screenWid,
"max-height": screenHei
});
new IScroll("#mWrapper", {
scrollX: true,
scrollY: false,
hScrollbar: false,
vScrollbar: false,
disableTouch: false,
HWCompositing: true,
snap: "li",
click: true,
momentum: false,
}).scrollToElement(".mtucebg ul li:nth-child(" + $mtucebgLiIndex + ")", 0);
time1 = new Date().getTime();
});
//pc左右鼠标滑过
$(document).on("mouseover mouseout", ".btnControl", function(e) {
e.type == "mouseover" && $(this).find("i").show();
e.type == "mouseout" && $(this).find("i").hide();
});
//手机关闭弹窗
$(document).on("click", "#mWrapper", function(e) {
time2 = new Date().getTime(); //截胡双击<<<<<<<-----mbd
if (time2 - time1 < 500) {
return;
};
$(".mtucebg").css({
display: "none"
});
});
};
pictureEvent.bindEvent();
});
//加载完成后的效果
$.getScript("/js/phone/plugin/wqdIscroll.js", function(data, textStatus, jqxhr) {
var pc = $(window).width() > 768 ? true : false;
var screenWid = $(window).width();
var screenHei = $(window).height();
//前四个可以调用
$(".wqd-atlas").not(".pohotoindex .wqd-atlas").each(function(i) {
$(this).find("a").each(function() {
if ($(this).attr("href").indexOf("javascript:void(0)") != -1) {
$(this).attr({
"href": "javascript:void(0)"
}).addClass("y-enlarge" + i).attr({
"onclick": "return false"
});
}
});
slider($(".y-enlarge" + i), ".wqd-atlas");
});
//滚动设置
if ($(".pohotoindex").length != 0 || $(".scrollBox").length != 0) {
//第五索引
$(".pohotoindex").each(function(i) {
var $this = $(this);
$this.attr("id", "wrapper1_" + i);
// $this.children().eq(0).width($this.find("ul li").length * $this.find("ul li").innerWidth());
setTimeout(function() {
$this.scroll = new IScroll("#wrapper1_" + i, {
scrollX: true,
scrollY: false,
hScrollbar: false,
vScrollbar: false,
disableTouch: false,
mouseWheel: true,
click: true,
preventDefault: false,
HWCompositing: $(window).width() >= 768 ? false : true,
});
$this.on('touchstart', mEvent);
$this.on('touchmove', mEvent);
$this.on('touchend', mEvent);
}, 100)
});
//第五展示
$(".pohotoshow").each(function(i) {
var $show = $(this);
var html = "";
var sonLen = $show.siblings(".pohotoindex").find(".wqd-atlas li").length;
$show.attr("id", "wrapper2_" + i).siblings(".pohotoindex").find(".wqd-atlas li a").each(function() {
var realTarget = $(this).attr("target") == "_blank" ? "target='_blank'" : "";
var menban = $(this).find(".mask").css("background-color");
html += "
";
$(this).attr({
"href": "javascript:void(0);"
}).removeAttr("target");
});
$show.html("
");
$show.find("a").each(function() {
if ($(this).attr("href").indexOf("javascript:void(0)") != -1) {
$(this).attr({
"href": "javascript:void(0)"
}).addClass("y-enlargeTuce5_" + i).attr({
"onclick": "return false",
"ondragstart": "return false"
});
}
});
slider($(".y-enlargeTuce5_" + i), ".pohotoshow");
setTimeout(function() {
$show.scroll = new IScroll("#wrapper2_" + i, {
scrollX: true,
scrollY: false,
hScrollbar: false,
vScrollbar: false,
disableTouch: false,
snap: "li",
click: true,
momentum: false,
HWCompositing: $(window).width() >= 768 ? false : true,
preventDefault: false,
});
$show.siblings().on("click ", ".wqd-atlas li a", function(e) {
if (e.type == "click") {
var index = $(this).parents("[data_pic]").index() + 1;
$show.scroll.scrollToElement("#wrapper2_" + i + " li:nth-child(" + index + ")", 500);
};
});
$show.on('touchstart', mEvent);
$show.on('touchmove', mEvent);
$show.on('touchend', mEvent);
}, 100)
}).css("opacity", 1);
if ($(window).width() <= 768) {
//第三滚动
$(".scrollBox").each(function(i) {
$this = $(this);
$this.attr("id", "wrapper3_" + i);
setTimeout(function() {
$this.scroll = new IScroll("#wrapper3_" + i, {
scrollX: true,
scrollY: false,
hScrollbar: false,
vScrollbar: false,
disableTouch: false,
click: true,
preventDefault: false,
HWCompositing: $(window).width() >= 768 ? false : true,
});
}, 100)
$this.on('touchstart', mEvent);
$this.on('touchmove', mEvent);
$this.on('touchend', mEvent);
});
};
};
//幻灯片
function slider(ele, par) {
if ($(window).width() > 786) {
// var num=1;
ele.colorbox({
rel: ele.attr("class"),
slideshow: true,
photo: true,
onOpen: function() {
$("#colorbox").css("outline", "none");
$("[data-elementtype]").length != 0 && $("body").append("
");
$("#cboxPrevious,#cboxNext,#cboxClose,#cboxSlideshow,#cboxLoadingGraphic,.cboxLoadingOverlay").css("opacity", 0);
$(".pictureShowL,.pictureShowR").hide();
$("#cboxLoadedContent").css({
"overflow": "hidden"
});
$(".btnControl,.pictureShowClose").show();
$("#cboxClose").css("opacity", 0);
// $("#cboxOverlay,#colorbox").css("display", "block");
ele.parents(par).find("a[href='javascript:void(0)']").each(function() {
var $a = $(this);
$a.attr({
"saveHref": $(this).attr("href"),
"href": $a.parents(".atlasWrap3,.atlasWrap4,.atlasWrap5").length != 0 ? $a.css("background-image").replace(/\"|\(|\)|url/g, "") : $a.find("img").attr("src"),
});
});
},
onComplete: function(e) {
//第一项的蒙版设置
$("#cboxLoadedContent").css({
position: "relative"
}).find("div").remove().end().append("
");
$(this).colorbox.resize();
},
next: "",
previous: "",
slideshowStart: "",
slideshowStop: "",
close: "",
speed: 0,
preloading: !0,
fixed: !0,
current: "",
slideshowAuto: !1,
loop: !1,
onClosed: function() {
ele.parents(par).find("a[saveHref]").each(function() {
$(this).attr({
"href": $(this).attr("saveHref"),
});
});
return false;
},
opacity: 0.5,
maxWidth: ($(window).width() > 786) ? "60%" : "90%",
maxHeight: "90%"
});
};
};
//手机事件
var startX, startY, moveX, moveY;
function mEvent(e) {
if (e.type == "touchstart") {
touch = e.originalEvent.changedTouches[0];
startX = touch.pageX;
startY = touch.pageY;
// e.preventDefault();
} else if (e.type == "touchmove") {
touch = e.originalEvent.changedTouches[0];
moveX = touch.pageX;
moveY = touch.pageY;
if (Math.abs(moveY - startY) / Math.abs(moveX - startX) < 1) {
e.preventDefault();
};
} else if (e.type == "touchend") {
// touch = e.targetTouches[0]
// moveX = touch.pageX;
// moveY = touch.pageY;
// if (Math.abs(moveY - startY) < 100) {
// e.preventDefault();
// };
// e.target.removeEventListener('touchmove',phone.move, false);
// e.target.removeEventListener('touchend', phone.end, false);
};
};
//中心弹出
function centerModal($modal,$source){
var centerX=$source.offset().left+$source.width()*0.5;
var centerY=$source.offset().top+$source.height()*0.5;
$modal.css({
"transform-orgin":centerX+"px "+centerY+"px",
"transform":"scale(0)"
});
};
});