$(function () { if ($("#eims_c_40014_1_panel").length > 0) { eims_c_40014_1.init(); } }); var eims_c_40014_1 = { init: function () { eims_c_40014_1.piczoom(); }, piczoom: function () { $.fn.picszoom = function (o) { var defaults = { sigbox: '#bigpic', //boxwh: [474, 369], //img: [1422, 1107], boxwh: [474, 369], img: [800, 662], zoom: 9 } var o = $.extend(defaults, o); //兼容ie8;因ie8下移动会有斗动! function format(str) { for (var i = 1; i < arguments.length; i++) { str = str.replace('%' + (i - 1), arguments[i]); } return str; } var _this = $(this), s = $(o.sigbox), imgw = o.img[0], imgh = o.img[1], movew = imgw / o.zoom, moveh = imgh / o.zoom, bleft = s.offset().left, btop = s.offset().top, sboxw = s.width(), sboxh = s.height(), bw = imgw - o.boxwh[0], bh = imgh - o.boxwh[1] boxleft = o.boxwh[0] + 1, p_box = _this.find("#smallpiclist"), p_boxul = p_box.find("ul"), liw = p_box.find("ul li").outerwidth(true), li = p_box.find("ul li").length, movebox = s.find(".move"); preid = "eims_c_40014_1_pre", nextid = "eims_c_40014_1_next"; $(o.sigbox).append(format("
", movew, moveh)); s.mouseover(function () { var _src = $(this).find("img").attr("src"); $(this).parent().append(format("
", o.boxwh[0], o.boxwh[1], boxleft, _src, o.img[0], o.img[1])); $(".move,.b_box").css("display", "block"); }).mouseout(function () { $(".b_box").remove(); $(".move").css("display", "none"); }); s.mousemove(function (e) { var x, y, _x, _y; x = e.pagex - bleft - movew / 2; y = e.pagey - btop - moveh / 2; if (x < 0) { x = 0; } else if (x > sboxw - movew) { x = sboxw - movew; } if (y < 0) { y = 0; } else if (y > sboxh - moveh) { y = sboxh - moveh; } $(".move").css({ "top": y, "left": x }); _x = -(x / (sboxw - movew)) * bw; _y = -(y / (sboxh - moveh)) * bh; $(".b_box img").css({ left: _x + "px", top: _y + "px" }); }); //上一个下一个函数封装 var p = { premove: function () { var ulmarginleft = parseint($("#smallpiclist ul").css("marginleft")); if (ulmarginleft > -liw) { p_boxul.css("marginleft", "0"); //console.log(ulmarginleft); return; }else{ p_boxul.animate({ marginleft: (ulmarginleft + liw) + "px" }, 500); } }, nextmove: function () { var ulmarginleft = parseint($("#smallpiclist ul").css("marginleft")); if ($("#smallpiclist").width() - ulmarginleft >= li * liw - (li - 1) * 8) { $("#smallpiclist").css("paddingright", "0px"); return; } p_boxul.animate({ marginleft: -liw + ulmarginleft + "px" }, 500); } } p_boxul.css({ "width": liw * li }); _this.find("#smallpiclist a").eq(0).addclass("xn_c_prodv_67_curr"); //上一个 $('#' + preid).bind("click", function () { if (li >= 2) { //p_boxul.find("li:last").prependto(p_boxul); p.premove(); } return false; }); var eims_c_40014_1_butright_click_bool = true; //下一个 $('#' + nextid).bind("click", function () { if (li >= 2) { if (!eims_c_40014_1_butright_click_bool) { return; } eims_c_40014_1_butright_click_bool = false; p.nextmove(); settimeout(function () { eims_c_40014_1_butright_click_bool = true; $('#' + nextid).bind("click") }, 400); } return false; }); //点击切换大图 _this.find("#smallpiclist a").bind("click", function () { var src = $(this).find("img").attr("src"), i = _this.find("#smallpiclist a").index(this); s.find("img").attr("src", src); _this.find("#smallpiclist a").removeclass("xn_c_prodv_67_curr").eq(i).addclass("xn_c_prodv_67_curr"); }) } } } $(function(){ var warp = $(".xn_f_19_wrap"); var sel = $(".xn_f_19_sel"); var seli = $(".xn_f_19_sel li"); var lktxt = $(".xn_f_19_lktxt"); var lkbtn = $(".xn_f_19_lkbtn"); var warph = warp.outerheight(); //获取盒子自身高度 var selht = sel.find("ul").outerheight(); var showmenu = true; var speed = 800; sel.css("height","0"); lktxt.html($(".xn_f_19_lkname").html()); $(".xn_f_19_lktxt,.xn_f_19_lkbtn").click(function(e){ //var wtop = document.getelementbyid("xn_f_19").offsettop; var wtop = warp.offset().top; //获取友情链接当前盒子距离页面顶部的距离 var scrolltop = $(window).scrolltop(); //获取滚动条距离顶部的距离 var widh = $(window).height(); //获取浏览器可视区域高度 var toph = wtop-scrolltop; //得到盒子距离浏览器可视区域上方的距离 var both = widh-toph-warph; //得到盒子距离浏览器可视区域上方的距离 if(showmenu){ warp.css("overflow","inherit"); if(toph > both){ sel.find("ul").addclass("xn_f_19_ul_topb").removeclass("xn_f_19_ul_botb"); sel.animate({"height":selht,"top":-(selht-1)},speed,function(){ showmenu = false; }); }else{ sel.find("ul").addclass("xn_f_19_ul_botb").removeclass("xn_f_19_ul_topb"); sel.stop(false,true).animate({"height":selht},speed,function(){ showmenu = false; }); } }else{ sel.stop(false,true).animate({"height":"0","top":warph},speed,function(){ showmenu = true; }); } e.stoppropagation(); //清除事件 }); seli.click(function(){ lktxt.html($(this).find(".xn_f_19_name").html()); $(this).addclass("xn_f_19_on").siblings().removeclass("xn_f_19_on"); sel.stop(false,true).animate({"height":"0","top":warph},speed); showmenu = true; }); $(document).click(function(){ sel.stop(false,true).animate({"height":"0","top":warph},speed); showmenu = true; }); }); $(function(){ var warp = $(".xn_f_20_wrap"); var sel = $(".xn_f_20_sel"); var seli = $(".xn_f_20_sel li"); var lktxt = $(".xn_f_20_lktxt"); var lkbtn = $(".xn_f_20_lkbtn"); var warph = warp.outerheight(); //获取盒子自身高度 var selht = sel.find("ul").outerheight(); var showmenu = true; var speed = 800; sel.css("height","0"); lktxt.html($(".xn_f_20_lkname").html()); $(".xn_f_20_lktxt,.xn_f_20_lkbtn").click(function(e){ //var wtop = document.getelementbyid("xn_f_20").offsettop; var wtop = warp.offset().top; //获取友情链接当前盒子距离页面顶部的距离 var scrolltop = $(window).scrolltop(); //获取滚动条距离顶部的距离 var widh = $(window).height(); //获取浏览器可视区域高度 var toph = wtop-scrolltop; //得到盒子距离浏览器可视区域上方的距离 var both = widh-toph-warph; //得到盒子距离浏览器可视区域上方的距离 if(showmenu){ warp.css("overflow","inherit"); if(toph > both){ sel.find("ul").addclass("xn_f_20_ul_topb").removeclass("xn_f_20_ul_botb"); sel.animate({"height":selht,"top":-(selht-1)},speed,function(){ showmenu = false; }); }else{ sel.find("ul").addclass("xn_f_20_ul_botb").removeclass("xn_f_20_ul_topb"); sel.stop(false,true).animate({"height":selht},speed,function(){ showmenu = false; }); } }else{ sel.stop(false,true).animate({"height":"0","top":warph},speed,function(){ showmenu = true; }); } e.stoppropagation(); //清除事件 }); seli.click(function(){ lktxt.html($(this).find(".xn_f_20_name").html()); $(this).addclass("xn_f_20_on").siblings().removeclass("xn_f_20_on"); sel.stop(false,true).animate({"height":"0","top":warph},speed); showmenu = true; }); $(document).click(function(){ sel.stop(false,true).animate({"height":"0","top":warph},speed); showmenu = true; }); }); $(function(){ var warp = $(".xn_f_21_wrap"); var sel = $(".xn_f_21_sel"); var seli = $(".xn_f_21_sel li"); var lktxt = $(".xn_f_21_lktxt"); var lkbtn = $(".xn_f_21_lkbtn"); var warph = warp.outerheight(); //获取盒子自身高度 var selht = sel.find("ul").outerheight(); var showmenu = true; var speed = 800; sel.css("height","0"); lktxt.html($(".xn_f_21_lkname").html()); $(".xn_f_21_lktxt,.xn_f_21_lkbtn").click(function(e){ //var wtop = document.getelementbyid("xn_f_21").offsettop; var wtop = warp.offset().top; //获取友情链接当前盒子距离页面顶部的距离 var scrolltop = $(window).scrolltop(); //获取滚动条距离顶部的距离 var widh = $(window).height(); //获取浏览器可视区域高度 var toph = wtop-scrolltop; //得到盒子距离浏览器可视区域上方的距离 var both = widh-toph-warph; //得到盒子距离浏览器可视区域上方的距离 if(showmenu){ warp.css("overflow","inherit"); if(toph > both){ sel.find("ul").addclass("xn_f_21_ul_topb").removeclass("xn_f_21_ul_botb"); sel.animate({"height":selht,"top":-(selht-1)},speed,function(){ showmenu = false; }); }else{ sel.find("ul").addclass("xn_f_21_ul_botb").removeclass("xn_f_21_ul_topb"); sel.stop(false,true).animate({"height":selht},speed,function(){ showmenu = false; }); } }else{ sel.stop(false,true).animate({"height":"0","top":warph},speed,function(){ showmenu = true; }); } e.stoppropagation(); //清除事件 }); seli.click(function(){ lktxt.html($(this).find(".xn_f_21_name").html()); $(this).addclass("xn_f_21_on").siblings().removeclass("xn_f_21_on"); sel.stop(false,true).animate({"height":"0","top":warph},speed); showmenu = true; }); $(document).click(function(){ sel.stop(false,true).animate({"height":"0","top":warph},speed); showmenu = true; }); });