$(function(){ /*收藏夹功能 start*/ $("#favorite_wb").click(function() { var h = "http://"+location.hostname; var j = location.title; try { window.external.addfavorite(h, j); } catch (i) { try { window.sidebar.addpanel(j, h, ""); } catch (i) { alert("对不起,您的浏览器不支持此操作!\n请您使用菜单栏或ctrl+d收藏丽子。"); } } }) /*收藏夹功能 end*/ /*顶部下拉 strat*/ $(".j_userinfo").on("mouseenter",".user",function(){ $('.user-menu').slidedown(200); $(this).addclass("user-active"); }).on("mouseleave",".user",function(){ $('.user-menu').slideup(200); $(this).removeclass("user-active"); }) /*顶部下拉 end*/ /*购物车弹出 strat*/ $("#ecs_cartinfo").on("mouseenter",function(){ $(this).addclass("topbar-cart-active") $(this).find(".cart-menu").slidedown(); }).on("mouseleave",function(){ $(this).removeclass("topbar-cart-active"); $(this).find(".cart-menu").stop().slideup(300,function(){ $(".cart-section").removeclass("cart-section-on") }); }) /*购物车弹出 end*/ /*搜索框效果*/ $(".header-search .search-text").focus(function(){ $("#searchform").addclass("search-form-focus"); }).blur(function(){ if($(this).val().length==0){ $("#searchform").removeclass("search-form-focus"); } }); /*分类树导航鼠标移入效果*/ $("#site-category-list").on("mouseenter",".category-item",function(){ $(this).addclass("category-item-current"); }).on("mouseleave",".category-item",function(){ $(this).removeclass("category-item-current"); }); /*分类树子菜单数目对6取余,重置子菜单宽度*/ /* $("#site-category-list .category-item").each(function(index, element) { var childnum=$(this).find(".children-list li").length; var col=math.ceil(childnum/6); if(col>1){ $(this).find(".children").addclass("children-col-"+col); $(this).find(".children").css("width",col*"265"); } }); */ /*分类树导航鼠标移入效果 start*/ $(".nav-category-section").on("mouseenter",".nav-category-item",function(){ $(this).addclass("current") }).on("mouseleave",".nav-category-item",function(){ $(this).removeclass("current") }) $nav_num = $("ul.children-list").find('li'); if($nav_num.length>8){ $('.nav-category-children').addclass('nav-category-children-col-2') }else{ $('.nav-category-children').removeclass('nav-category-children-col-2') } /*分类导航鼠标移入效果 end*/ /*首页导航分类树效果*/ $(".nav-category").mouseenter(function(){ $(this).find(".category-hidden").show(); }).mouseleave(function(){ $(this).find(".category-hidden").hide(); }); /*首页导航下拉子菜单*/ var t1; var t2; var t3; //鼠标经过导航 $(".header-nav li.nav-item").mouseenter(function(){ cleartimeout(t3); cleartimeout(t2); $(this).addclass("nav-item-active"); var nav_list=$(this).find(".item-children .children-list"); if(!$("#j_navmenu").hasclass("header-nav-menu-active")){ $("#j_navmenu").addclass("header-nav-menu-active"); } $("#j_navmenu").find(".container").html(nav_list.clone());//复制ul var obj = $("#j_navmenu").find(".container"); if($.trim(obj.html())) { t1=settimeout(function(){ $("#j_navmenu").slidedown(200);//子菜单显示 },200); } }); //鼠标离开导航 $(".header-nav li.nav-item").mouseleave(function(){ cleartimeout(t1); $(this).removeclass("nav-item-active"); t2=settimeout(function(){ $("#j_navmenu").slideup(200);//子菜单隐藏 },200); }); //鼠标经过子菜单 $("#j_navmenu").mouseenter(function(){ cleartimeout(t2); }); //鼠标离开子菜单 $("#j_navmenu").mouseleave(function(){ t3=settimeout(function(){ $("#j_navmenu").slideup(200);//子菜单隐藏 },200); }); /*首页底部视频*/ $("#video .video-list a").click(function(){ var wh=$(window).height(); var url=$(this).attr("data-video"); var title=$(this).parents(".video-item").find("h3.title a").html(); var bgclass="modal-backdrop fade in"; var bg=$("
"); bg.appendto($("body")); $("#j_modalvideo h3.title").html(title); $("#j_modalvideo iframe").attr("src",url); $("#j_modalvideo").show().css({opacity:0}).animate({opacity:1}).addclass("in"); }); $("#j_modalvideo a.close").click(function(){ $("#j_modalvideo").removeclass("in"); $("#j_modalvideo").css({opacity:0}); $("#j_modalvideo iframe").attr("src",''); var f=settimeout(function(){ $("#j_modalvideo").hide() $(".modal-backdrop").fadeout(300,function(){$(this).remove()}); },300); }); /*列表页 属性图片 幻灯片*/ $(".j_attrimg").slide({ maincell:".j_imglist", autopage:true, effect:"left", autoplay:false, vis:5, scroll:5, trigger:"click", pnloop:false }); //登录注册页 });