/**************** ǰ̨ҳ�湫�õ�js���� *******************/ // swf����һ����վȫ�ֵķ��������洢ǰ̨��վ�ĸ�����������websitefunction wsf = {} wsf.f = { //�����ժ��� s_j: function(st) { //�ַ���ת����json if (!!st) { var j = "{" + st + "}"; j = eval('(' + j + ')'); return j; } else { j = {}; return j; } }, j_s: function(j) { //��jsonת�����ַ��� var x = []; for (i in j) { x.push(i + ":" + j[i]); } return x.join(","); } }; // վ�㵼���ķ���,��ҫ��������ʾ�������ӵ����˵��� wsf.nav = function(){ $("#nav").on({ mouseenter: function() { var that = $(this), sub = that.find("div.nsub"); if (sub.length) { that.addclass('nitemsub'); var l = that.offset().left, pl = sub.width() + l; if (pl > $(document).width()) { sub.css({ left: 'auto', right: 0 }); } } if(!that.hasclass('nitemcur')){ that.addclass("nitemh"); } }, mouseleave: function() { $(this).removeclass("nitemh"); $(this).removeclass("nitemsub"); } }, '.nitem'); }; /*��վ��logo search shopcart λ�ü���*/ // wsf.hoffl = function(){ // var logo = $("#logo"),searchs = $("#search"),shopcart = $("#shopping_car"),webnav = $('#web_nav'), // hcl = math.floor(($("body").width() - usersitewidth)/2); // logo.css({'left': parseint(logo.css('left')) + hcl}); // searchs.css({'left': parseint(searchs.css('left')) + hcl}); // shopcart.css({'left': parseint(shopcart.css('left')) + hcl}); // if(parseint(webnav.css('left')) > 0){ // webnav.css({'left': parseint(webnav.css('left')) + hcl}); // } // }; /*��վ��logo search shopcart λ�ü���*/ wsf.hoffl = function(){ var j = 0; var p = function(obj,t){ if(t == 'n'){ if(obj.attr('data-l')){ j = wsf.f.s_j(obj.attr('data-l')); } }else{ if(obj.attr('data-s')){ j = wsf.f.s_j(obj.attr('data-s')); } } }; var logo = $("#logo"),searchs = $("#search"),shopcart = $("#shopping_car"),webnav = $('#web_nav'); var hcl = math.floor(($("body").width() - usersitewidth)/2); if(logo.length){ p(logo); logo.css({'left': j.l + hcl}); } if(searchs.length){ p(searchs); searchs.css({'left': j.l + hcl}); } if(shopcart.length){ p(shopcart); shopcart.css({'left': j.l + hcl}); } if(webnav.length){ p(webnav,'n'); if(j.p == 1 || j.p == 3){ webnav.css({'left': j.l + hcl}); } } }; // �������û���logo,search,shopping�ϱ߾ඨλ wsf.hofft = function(){ var logo = $("#logo"),searchs = $("#search"),shopcar = $("#shopping_car"), logot = parseint(logo.css('top')),searcht = parseint(searchs.css('top')),shopcart = parseint(shopcar.css('top')),toph = $("#top_area").outerheight(); logo.css({top : logot + toph +'px'}); searchs.css({top : searcht + toph +'px'}); shopcar.css({top : shopcart + toph +'px'}); }; /* fixedshopcar ��ҫ������ʾǰ̨�ĸ������ﳵ������ߵ�һщ���� */ wsf.fixedshopcar = function(){ var fixedshopcar = $("#fixedshopcar"), shopcaralert = fixedshopcar.find("div.shopcar-alert"), listbody = fixedshopcar.find("dd.shopcar-list-body"), listul = listbody.find(".shopcar-list-ul"); listbody.cscroll({ w: 10, tbb: false }); fixedshopcar.on({ click: function() { var that = $(this); if (that.data("alertshow") == 1) { that.removedata("alertshow"); shopcaralert.css({ 'visibility': 'hidden' }); } else { that.data("alertshow", 1); shopcaralert.css({ 'visibility': 'visible' }); } } }, ".shopcar-icon"); fixedshopcar.on({ click: function() { fixedshopcar.find(".shopcar-icon").removedata("alertshow"); shopcaralert.css({ 'visibility': 'hidden' }); } }, ".shopcar-alert-close"); listul.on({ click: function() { var par = $(this).parent().parent(); par.animate({ height: 0, opacity: 0 }, 500, function() { $(this).remove(); if (listul.height() > listbody.height()) { listbody.cscroll({ w: 10, tbb: false }); } else { listbody.cscroll({ w: 10, tbb: false }); listbody.find(".c-scrollbar").hide(); } }); } }, "span.span-option a"); }; /* focus-pic-module createdate:2015/04/02 ģ���ڽ���ͼ��������ҫ��ģ���еľ���ͼ�л����� */ wsf.focuspicmodule = function(){ $("div.focus-pic-module").each(function() { var obj = $(this); var h = obj.parent().height(), w = obj.parent().width(), dd = obj.find("dd"), dl = obj.find("dl"), type = obj.data("type"), dir = obj.data("dir"), sum = dd.length, curi = 0, ni = curi + 1, times, move, fun; dl.css({ "width": w + "px", "height": h + "px", "overflow": "hidden" }); dd.css({ "width": w + "px", "height": h + "px" }); //�ж����õķ��� (function() { var scss; switch (dir) { case 1: //left scss = { left: (w + 10) + "px", top: 0 }; break; case 2: //right scss = { left: -(w + 10) + "px", top: 0 }; break; case 3: //top scss = { top: (h + 10) + "px", left: 0 }; break; case 4: //bottom scss = { top: -(h + 10) + "px", left: 0 }; break; } dd.each(function() { var that = $(this); if (that.index() != curi) { that.css(scss); } else { that.css({ left: 0, top: 0 }); } }); })(); //�ж����õ����� if (sum > 1) { (function() { switch (type) { case 1: case 2: var controls = $('
'); for (var s = 0; s < sum; s++) { if (type == 1) { var span = $('' + (s + 1) + ''); if (s === curi) { span = $('' + (s + 1) + ''); } } else if (type == 2) { var span = $(''); if (s === curi) { span = $(''); } } controls.append(span); } obj.append(controls); fun = function(i) { obj.find(".focus-controls-list span:eq(" + i + ")").addclass("cur").siblings().removeclass("cur"); } obj.on({ click: function() { var indexs = $(this).index(); if (indexs != curi) { if (!obj.data("move")) { move(indexs); } } } }, ".focus-controls-list span"); break; case 3: var nextbtn = $(''), prevbtn = $(''); obj.append(nextbtn, prevbtn); obj.on({ mouseenter: function() { var this_ = $(this); if (!this_.data("type3btn")) { obj.find(".focus-pic-next,.focus-pic-prev").css({ visibility: 'visible' }); this_.data("type3btn", 1); } }, mouseleave: function() { var this_ = $(this); if (this_.data("type3btn") == 1) { obj.find(".focus-pic-next,.focus-pic-prev").css({ visibility: 'hidden' }); this_.removedata("type3btn"); } } }); fun = function(i) { obj.find(".focus-pic-next").data("num", i + 1); obj.find(".focus-pic-prev").data("num", i - 1); }; fun(curi); obj.find(".focus-pic-next").on("click", function() { if (!obj.data("move")) { move($(this).data('num')); } }); obj.find(".focus-pic-prev").on('click', function() { if (!obj.data("move")) { move($(this).data('num')); } }); break; } })(); //�ƶ����� function move(c) { if (c == sum) { c = 0; } if (c < 0) { c = sum - 1; } obj.data("move", 1); var chnum = function() { curi = c; ni = c + 1; obj.data("move", 0); }; if (dir == 1) { $(dd[c]).animate({ left: 0 }, 1000, function() { chnum(); }); $(dd[curi]).animate({ left: -w }, 1000, function() { $(this).css({ left: (w + 10) + "px" }); }) } if (dir == 2) { $(dd[c]).animate({ left: 0 }, 1000, function() { chnum(); }); $(dd[curi]).animate({ left: w }, 1000, function() { $(this).css({ left: -(w + 10) + "px" }); }) } if (dir == 3) { $(dd[c]).animate({ top: 0 }, 1000, function() { chnum(); }); $(dd[curi]).animate({ top: -(h + 10) }, 1000, function() { $(this).css({ top: (h + 10) + "px" }); }) } if (dir == 4) { $(dd[c]).animate({ top: 0 }, 1000, function() { chnum(); }); $(dd[curi]).animate({ top: h + 10 }, 1000, function() { $(this).css({ top: -(h + 10) + "px" }); }) } fun(c); } var settime = function() { times = setinterval(function() { move(ni); }, 5000); }; obj.on({ mouseenter: function() { clearinterval(times); }, mouseleave: function() { settime(); } }); settime(); } }); }; /* text-list-module\pic-text-list-module createdate:2015/07/20 �ı��б��ͼ����ϣ�б�ģ��ķ��� */ wsf.textlistmodule = function(){ $("div.text-list-module,div.pic-text-list-module").on({ mouseenter : function(){ $(this).addclass("lihover"); }, mouseleave : function(){ $(this).removeclass("lihover"); } },"li"); }; /* cataloglist ���η���ŀ¼��ҫ��ģ��ķ���ŀ¼js�����������ƶ� */ wsf.cataloglist = function() { var cataloglist = $("div.cataloglist"); var catalogh = function(obj) { var onedl = obj.children("dl.oneclasslist"); if (obj.height() < onedl.height() || parseint(onedl.css("margin-top"), 10) < 0) { obj.find("big.but").show(); } else { obj.find("big.but").hide(); } }; var move = function(obj, dir) { var onedl = obj.find("dl.oneclasslist"), t_h = obj.height(), dl_t = math.abs(parseint(onedl.css("margin-top"), 10)), dl_sh = onedl.height() - dl_t, judge; if (dir == 'up') { judge = (dl_sh - t_h) > 0 ? true : false; } else if (dir == 'down') { judge = dl_t > 0 ? true : false; t_h = -t_h; } if (judge) { if (onedl.data('moving') != 1) { onedl.data('moving', 1); onedl.animate({ margintop: -(dl_t + t_h / 3) }, 500, function() { onedl.removedata('moving', 1); }); } } } cataloglist.each(function() { var that = $(this); that.css({ height: that.parent().height() + "px", width: that.parent().width() + "px" }); //������չ���պ������¼� that.on({ click: function() { var this_ = $(this), pdt = this_.parent().parent(), num; if (pdt.hasclass('oneclasst')) { num = 'one' } else if (pdt.hasclass('twoclasst')) { num = 'two' } else if (pdt.hasclass('threeclasst')) { num = 'three' } if (this_.hasclass('open')) { pdt.removeclass(num + 'classtopen').next("dd").removeclass(num + 'classcopen'); this_.removeclass("open"); } else { pdt.addclass(num + 'classtopen').next("dd").addclass(num + 'classcopen'); this_.addclass("open"); } catalogh(that); } }, "dt code"); that.on({ mouseenter : function(){ var pdt = $(this); if (pdt.hasclass('oneclasst')) { num = 'one' } else if (pdt.hasclass('twoclasst')) { num = 'two' } else if (pdt.hasclass('threeclasst')) { num = 'three' } pdt.addclass(num + 'classthover'); }, mouseleave : function(){ var pdt = $(this); if (pdt.hasclass('oneclasst')) { num = 'one' } else if (pdt.hasclass('twoclasst')) { num = 'two' } else if (pdt.hasclass('threeclasst')) { num = 'three' } pdt.removeclass(num + 'classthover'); } },"dt") // �����°�ť���¼� that.on({ click: function() { if ($(this).hasclass('upbut')) { move(that, 'down'); } else if ($(this).hasclass('downbut')) { move(that, 'up'); } } }, "big.but"); // ��Ԫ�ر�����¼� that.on({ mouseenter: function() { var this_ = $(this); this_.css({ height: this_.parent().height() + "px", width: this_.parent().width() + "px" }); var dl = this_.find("dl.oneclasslist"), dl_h = dl.height(), t_h = this_.height(); if (dl_h > t_h || parseint(dl.css("margin-top"), 10) < 0) { this_.find("big.but").show(); } }, mouseleave: function() { $(this).find("big.but").hide(); } }) }); }; /* menu-catalog-module �����ͷ���ŀ¼��ҫ����չʾ������� */ wsf.menucatalogmodule = function() { $("div.menu-catalog-module").each(function() { var menucatalog = $(this), thatp, mo, moid, catalog, leveobj, hidetimefun, hidecatalog = function() { hidetimefun = settimeout(function() { leveobj.removeclass('one-class-hover'); catalog.css("width", 0); }, 500); }; menucatalog.on({ mouseenter: function() { }, mouseleave: function() { hidecatalog(); } }) menucatalog.on({ mouseenter: function() { cleartimeout(hidetimefun); leveobj = $(this); $(this).addclass("one-class-hover").siblings('dd').removeclass('one-class-hover'); var indexs = leveobj.index(), that_t = leveobj.position().top, that_h = leveobj.outerheight(), inner = leveobj.find(".one-class-inner"), inner_mt = parseint(inner.css("margin-top")), inner_tbw = parseint(inner.css("bordertopwidth")), inner_h = inner.innerheight(); thatp = leveobj.parent().parent(); mo = leveobj.parents("div.mo"); moid = mo.attr("id"); catalog = $("#menucatalogmore_" + moid.substr(3)); catalog.off().on({ mouseenter: function() { cleartimeout(hidetimefun); }, mouseleave: function() { hidecatalog(); } }) var l = thatp.offset().left, t = thatp.offset().top, gap = catalog.find("big.gap"), gap_h = inner_h, gap_t = that_t + inner_tbw + inner_mt, moreinner = catalog.find(".catalog-more-inner"), morelist = catalog.find(".catalog-more-list:eq(" + indexs + ")"); l = l + thatp.width() - 2; gap.css({ height: gap_h + "px", top: gap_t + "px" }); morelist.siblings().hide(); if(morelist.find("dl").length >= 1){ morelist.show(); catalog.css({visibility:'visible'}); }else{ catalog.css({visibility:'hidden'}); } moreinner.css({ minheight: gap_h + "px", margintop : gap_t - inner_tbw + 'px' }); catalog.css({ left: l + "px", top: t + "px" }).animate({ width: moreinner.outerwidth() }, 200, function() { catalog.css({ width: "auto" }); }); }, mouseleave: function() { //$(this).removeclass("one-class-hover"); } }, "dd.one-class"); }); }; /* tablemodule createdate:2015/05/11 ������������class */ wsf.tablemodule = function() { var tablemodule = $('div.tablemodule'); tablemodule.each(function() { $(this).find('tr:first').addclass('trhead'); }); }; /* tab-switch-module createdate:2015/03/24 ģ���ǩ���л����� */ wsf.tabswitchmodule = function() { var tabswitch = $("div.tab-switch-module"), tabt = tabswitch.find("div.tab-switch-t"), tabc = tabswitch.find("div.tab-switch-c"); tabt.on({ click: function() { if(tabt.data('noswitch') != 1){ var that = $(this), indexs = that.index(); that.find("span").addclass("active"); that.siblings("li").find("span").removeclass("active"); tabc.find('.tab-c-item').each(function() { if ($(this).index() == indexs) { $(this).addclass("tab-c-item-active"); } else { $(this).removeclass("tab-c-item-active"); } }) } } }, "li"); }; // ���ɱ༭ģ�� wsf.customeditmodule = function(){ var customeditmodule = $('div.custom-edit-module').each(function(){ var t = $(this),tp = t.parent(); t.css({height : tp.height()}); }) }; /* row-classify-module createdate:2015/08/16 �����ʒ�����б�ģ��ķ��� */ wsf.classifymodule = function(){ $("div.classify-module").on({ mouseenter : function(){ $(this).addclass("classify-hover"); }, mouseleave : function(){ $(this).removeclass("classify-hover"); } },".big-classify,.small-classify"); }; /*ѡ���б�*/ wsf.selectstate = function(){ $("#filtersort").on({ mouseenter : function(){ $(this).addclass("select-state-hover"); }, mouseleave : function(){ $(this).removeclass('select-state-hover'); } },".select-state") }; // �ֶ��ƶ�ģ�� wsf.manualmovemodule = function(obj){ var manual; manual = obj ? obj : $("div.manual-move-module"); manual.each(function(){ var t = $(this), li = t.find('li'), linum = li.length, liw = li.outerwidth(), ulp = t.find(".pic-text-list-module"); ulp.width(liw * linum); }); manual.on({ click : function(){ var t = $(this), id = t.data('id'), obj = t.parent(); movefun(id,obj); } },'em.prev-move,em.next-move'); manual.on({ mouseenter : function(){ var t = $(this); t.find('em.prev-move,em.next-move').css('visibility','visible'); }, mouseleave : function(){ var t = $(this); t.find('em.prev-move,em.next-move').css('visibility','hidden'); } }); var movefun = function(dir,obj){ var curmanual = obj, list = curmanual.find('.manual-move-body'), ulp = curmanual.find(".pic-text-list-module"), li = ulp.find('li'), linum = li.length, liwidth = li.outerwidth(), shownum = math.floor((list.width()) / liwidth), ulpw = ulp.width(), ulpleft = math.abs(parseint(ulp.css('margin-left'))), move = shownum * liwidth, newmove = ulpw - (ulpleft + move), nowmove; if(curmanual.data('move') == 1) return false; curmanual.data('move',1); if(dir == 'next'){ if(newmove > 0 && newmove > move){ nowmove = move; }else{ nowmove = newmove; } if(ulpw > move){ ulp.animate({ "marginleft": "-=" + nowmove }, 500,function(){ curmanual.removedata('move'); }); } }else{ nowmove = ulpleft > move ? move : ulpleft; ulp.animate({ "marginleft": "+=" + nowmove }, 500,function(){ curmanual.removedata('move'); }); } }; }; /* //jquery focusimg //qwguo qwguo@sohu.com //copyright www.ev123.com // ����ͼjs���� */ (function($) { $.fn.extend({ focusimg: function(options) { return this.each(function() { var opts = { uistyle: "style-1", fnclass: "inout", evtype: "mouseenter", usertime: 6 }; opts = $.extend(opts, options); var full = $(this), fwidth = full.parent().width(), fheight = full.parent().height(), uistyle = opts.uistyle, fnclass = opts.fnclass, pul = full.children("ul"), pli = pul.find("li"), bnav = $(""), times = null, an = true, y = 0, change = function(e) { //ͼƭ��ַ���� var curli = e, bigpic = curli.attr("bigpic"), bcolor = curli.attr("bcolor"); curli.css({ "background-color": bcolor, "background-image": "url(" + bigpic + ")" }); curli.attr("change", "true"); }, eventfn = function(obj, fobj) { //�¼�ģʽ obj.find(fobj).each(function(e) { $(this).bind(opts.evtype, function() { eval(fnclass + "(e)"); }); }); }; switch (opts.fnclass) { case 'inout': (function() { pul.addclass('banner-pic-1').css({ "height": fheight }); pli.each(function() { $(this).css({ "height": fheight }); }); })(); break; case 'lmove': (function() { full.css({ "height": fheight + "px" }); pul.addclass('banner-pic-2').css({ "width": pli.length * fwidth + "px", "height": fheight + "px" }); pli.each(function() { $(this).css({ "width": fwidth + "px", "height": fheight }); }); })(); break; case 'tmove': (function() { full.css({ "height": fheight + "px" }); pul.addclass('banner-pic-3').css({ "height": pli.length * fheight + "px" }); pli.each(function() { $(this).css({ "height": fheight }); }); })(); break; } switch (opts.uistyle) { case "style-1": if(pli.length > 1){ var ban = $(""); pli.each(function(e) { ban.append(""); }) full.append(bnav.attr("class", "banner-nav-1").html(ban)); eventfn(ban, "span"); } break; case "style-2": if(pli.length > 1){ var ban = $(""); pli.each(function(e) { ban.append("" + (e + 1) + ""); }) full.append(bnav.attr("class", "banner-nav-2").html(ban)); eventfn(ban, "span"); } break; case "style-3": var ban = $(""); pli.each(function() { var smallurl = $(this).attr("smallpic") ? $(this).attr("smallpic") : $(this).attr("bigpic"); var s = $("").html("