$(function(){ // body 宽度 初始化 /** * @return {body width} */ function init(){ var _w = $(window).width(); if(_w <1270){ _w = 1270; } $("body").css("width",_w +'px'); } init(); $(window).resize(function(){ init(); }) // ---------------------华丽丽的分割线------------------------- // *.width init function list_init_fn(){ // index 别墅装修案例 small list size var _s_ul = $("#mod_case div.small_list ul"), _s_size = _s_ul.find("li").size(); _s_ul.css("width",_s_size * 229 +'px'); } list_init_fn(); // ---------------------华丽丽的分割线------------------------- // 首页搜索表单 选择 按钮下拉选项 $("#sea_select").hover(function(){ var _wrap = $("#sea_select .sel_wrap"); $(this).addclass('hover'); _wrap.stop(true).slidedown(500); },function(){ $(this).removeclass('hover'); $(this).find('.sel_wrap').slideup(200); }) $("#sea_select span").on("click",function(){ var em = $("#sea_select em"), _wrap = $("#sea_select .sel_wrap"); var seatxt = $(this).text(), seatype = $(this).attr("data-type"); $(this).text(em.text()); $(this).attr("data-type",em.attr("data-type")); em.text(seatxt); em.attr("data-type",seatype); $("#data-type").attr("value",seatype); _wrap.stop(true).slideup(100); }); // ---------------------华丽丽的分割线------------------------- // 二级下拉菜单 bg效果 $("#subnav li").hover(function(){ $(this).find(".bg").stop().animate({width:'95px',left:0},{duration:500,easing:'swing'}); },function(){ $(this).find(".bg").stop().animate({width:0,left:59},{duration:350,easing:'swing'}); }); // ---------------------华丽丽的分割线------------------------- // 首页导航菜单 $("#mnnav li:gt(0)").hover(function(){ $("#subnav").stop(true).animate({opacity:1,height:240},{duration:350}); }) $("#nav-wrapper").mouseleave(function(){ $("#subnav").stop(true).animate({opacity:0,height:0},{duration:350}); }); // ---------------------华丽丽的分割线------------------------- // 首页 banner 切换 var _b_index = 0; $("#banner ul.img_list li") $("#banner div.btn li").click(function(){ _b_index = $(this).index(); banneractive(); }) function banneractive(){ $("#banner ul.img_list li") .eq(_b_index).stop(true,false).show().find("a").animate({opacity:1},{duration:1000,easing:'easeoutcirc'}) .parents("li").siblings('li').stop(true,false).hide().find("a").animate({opacity:0},0); $("#banner div.btn li").eq(_b_index).addclass('active').siblings("li").removeclass('active'); } function bannerrun(){ _b_index ++; if(_b_index>=$("#banner ul.img_list li").length){ _b_index = 0; } banneractive(); } var banner_timer = setinterval(bannerrun,5500); $("#banner").hover(function(){ clearinterval(banner_timer); },function(){ banner_timer = setinterval(bannerrun,5500); }) // ---------------------华丽丽的分割线------------------------- // 首页 精品案例 tab切换 $("#mod .tab span").click(function(){ var _index = $(this).index(); $(this).addclass('active').siblings('span').removeclass('active'); $("#mod div.c_wrap").eq(_index).show().siblings('div').hide(); }) // ---------------------华丽丽的分割线------------------------- // 首页 设计师展示 $("#mod-desinger li").hover(function(){ var _this = $(this); _this.find("div.float,div.mask").stop(false,true).animate({bottom:"-39px"},{duration:500,easing:"easeoutexpo"}); _this.find("div.float-wrapper,div.mask-wrapper").stop(true,true).animate({left:0},{duration:750,easing:"swing"}); },function(){ var _this = $(this); _this.find("div.float-wrapper,div.mask-wrapper").stop(false,true) .animate({left:"-261px"},{duration:300,easing:"swing",complete:function(){ _this.find("div.float,div.mask").stop(true,true).animate({bottom:0},{duration:750,easing:"linear"}); }}); }); // 内页导航固定 $(window).scroll(function(){ var scroll1 = $(document).scrolltop(); var nav = $("div.nav-a"); if(scroll1>124){ $("div.nav-a").addclass("fixed"); }else{ $("div.nav-a").removeclass("fixed"); } }); // ---------------------华丽丽的分割线------------------------- // 首页 客户见证 (function(){ var index = 0, len = $("#ul-wrapper ul").length, wrapper = $("#ul-wrapper"), wrapper_hover = $("#ul-wrapper,#ke-btn"), btn = $("#ke-btn a"); btn.click(function(){ index = $(this).index(); ulani(); }) function run(){ index ++; if(index >= len){ index = 0; } ulani(); } function ulani(){ wrapper.animate({left:-index*346},{duration:750,easing:"easeoutexpo",complete:function(){ btn.eq(index).addclass("active").siblings("a").removeclass("active"); }}) } var timer = setinterval(run,3000); wrapper_hover.hover(function(){ clearinterval(timer); },function(){ timer = setinterval(run,3000); }) }()); // ---------------------华丽丽的分割线------------------------- // 别墅装修案例 $.bnr({ atype:"li", smallli:$("#mod_case div.small_list li"), bigli:$("#mod_case ul.img_list li"), ul:$("#mod_case div.small_list ul"), next:$("#mod_case span.next"), prev:$("#mod_case span.prev"), focsname:"active", speed:750, autotime:5000, visiblesize:5, bigbox:$("#mod_case div.big_list"), smallbox:$("#mod_case div.small_list"), margin:19, liouter:55, hoverclass:"hover" }); // ---------------------华丽丽的分割线------------------------- // 最新热门案例 $("#mod ul.con2 li").hover(function(){ var _this = $(this); _this.addclass("hover").stop(true,true).animate({color:"#fff"},{duration:750,easing:"swing"}); _this.find("span.name").animate({color:"#fff"},{duration:750,easing:"swing"}); _this.find("div.mask").stop(true,true).animate({opacity:0.75},{duration:750,easing:"swing"}); _this.find("a.go").stop(true,true).animate({opacity:0.75},{duration:750,easing:"swing"}); },function(){ var _this = $(this); _this.removeclass("hover").stop(true,true).animate({color:"#999"},{duration:300,easing:"swing"}); _this.find("span.name").animate({color:"#000"},{duration:350,easing:"swing"}); _this.find("div.mask").stop(true,true).animate({opacity:0},{duration:350,easing:"swing"}); _this.find("a.go").stop(true,true).animate({opacity:0},{duration:350,easing:"swing"}); }) // 用户中心 左侧点击 $("#u-side span").click(function(){ $(this).next().slidetoggle(); $(this).parent().toggleclass("active"); }) // brand $("#brand-btn li").click(function(){ var index = $(this).index(); $(this).addclass("active").siblings("li").removeclass("active"); $("#brand-wrapper div.brand-wrapper").eq(index).show().siblings("div").hide(); }) // 荣誉 $("#slide-bg").click(function(){ $("#slide-bg-wrapper").toggleclass("active"); $("#honner").stop(false,true).slidetoggle(300); }); // 发展历程 (function(){ var index = 0, item_len = $("#gp-wrapper div.item").length-5; var item_height = $("#gp-wrapper div.item:last").outerheight()+50; $("#gp-up").click(function(){ if(item_len >=1){ index ++; var items_height = $("#gp-wrapper div.item").eq(index).height() > 96 ? ($("#gp-wrapper div.item").eq(index).height()+30):146; console.log(items_height); if(index < item_len){ if (index == item_len-1) { $("#gp-wrapper").animate({top:-((index-1) * items_height + item_height)},{duration:500,easing:"easeoutexpo"}); } else { $("#gp-wrapper").animate({top:-(index * items_height)},{duration:500,easing:"easeoutexpo"}); } } console.log(index); } }); $("#gp-wrapper a").hover(function(){ $(this).find("div.tips").stop(false,true).fadein(200); },function(){ $(this).find("div.tips").stop(false,true).fadeout(200); }); $(".development_home").click(function(){ $("#gp-wrapper").animate({top:0},{duration:500,easing:"easeoutexpo"}); }); }()); // 发布日记 (function(){ var _size_a = $("#_size_wrapper a"), _size = $("#_size"), _style_a = $("#_style_wrapper a"), _style = $("#_style"); _size_a.click(function(){ $(this).addclass("active").siblings("a").removeclass("active"); _size.val($(this).data("id")); }) _style_a.click(function(){ $(this).addclass("active").siblings("a").removeclass("active"); _style.val($(this).data("id")); }) }()); // 首页服务 固定 $(window).scroll(function(){ var top = $(window).scrolltop(), services = $("#index-service"), sidenav = $("#side-nav"); if(top>=575){ if(!services.hasclass("fixed")){ services.addclass("fixed"); } }else{ services.removeclass("fixed"); } if(top>=1){ if(!sidenav.hasclass("fixed")){ sidenav.addclass("fixed"); } }else{ sidenav.removeclass("fixed"); } }); // 精品装修 (function(){ var id = 0, name = "", urls = "", counts = 0, counts1 = 0, src = ""; var big = $("#big"), big_name = $("#case-name"), big_url = $("#go-detail"), big_count = $("#count"), big_count1 = $("#count1"), big_img = big.find("img"); var _left = 0, _top = 0; $("#case-show div.hover-show").hover(function(){ id = $(this).data("id"); name = $(this).data("name"); urls = $(this).data("url"); if($(this).hasclass("active")){ big_count.prev("i").addclass("active"); }else{ big_count.prev("i").removeclass("active"); } if($(this).hasclass("count1-active")){ big_count1.prev("i").addclass("active"); }else{ big_count1.prev("i").removeclass("active"); } counts = $(this).attr("data-counts"); counts1 = $(this).attr("data-count1"); src = $(this).data("src"); big_count.text(counts); big_count1.text(counts1); big_url.attr("href",urls); big_name.text(name); big.attr("data-id",id); big_img.attr("src",src); _left = $(this).parents("li").offset().left; big.css("left",_left + 'px'); big.stop(true).fadein({duration:1400,easing:'easeoutcirc'}); }); var $counts = 0; $("#case-show-wrapper").mouseleave(function(){ big.stop(true).fadeout(500); }); })(); $("#backtop").click(function(){ $("html,body").animate({scrolltop:0},{duration:500,easing:"easeoutexpo"}); }); $("#side-nav a.close").click(function(){ $(this).parents("div.float-box").fadeout(); $(this).parents("li").removeclass("active"); }) showfloatbox("#jijia","#jijia-box"); showfloatbox("#yuyue","#yuyue-box"); showfloatbox("#yanfang","#yanfang-box"); showfloatbox("#wx","#wx-box"); $("#side-nav a.close").click(function(){ $(this).parents("div.float-box").fadeout(); $(this).parents("li").removeclass("active"); }) function showfloatbox(str,obj){ $(str).click(function(e){ var $wheight = $(window).height(), $strtop = e.clienty, $objheight = $(obj).height(), $top = $strtop + $objheight, $reltop = $top - $wheight + 20; $(this).parent().toggleclass("active").siblings().removeclass("active").find("div.float-box").hide(); $(obj).fadetoggle(); if($top >$wheight){ $(obj).animate({top:-$reltop}); $(str).prev().fadeout({duration:500,easing:"easeoutexpo"}); } console.log("$strtop:" + $strtop + ",$objheight:" + $objheight); }); } // 别墅装修案例 $("#caseli li").hover(function(){ var _this = $(this); _this.find("span.mask").stop(true).animate({opacity:0.65},{duration:750,easing:"easeoutexpo"}); _this.find("div.des-li-infowrap").stop(true).animate({opacity:1},{duration:750,easing:"easeoutexpo"}); },function(){ var _this = $(this); _this.find("span.mask").stop(true).animate({opacity:0},{duration:750,easing:"easeoutexpo"}); _this.find("div.des-li-infowrap").stop(true).animate({opacity:0},{duration:750,easing:"easeoutexpo"}); }); /** * 弹出窗 * 显示 */ function showmsg(){ $("#dialog").fadein(500); } /** * 弹出窗 * 隐藏 */ function hidemsg(){ $("#dialog").fadeout(500); } $("#closedialog,#closedialog1,#dialog div.mask").on("click",function(){ hidemsg(); }); /** * 弹出窗 * 登录 */ function showloginmsg(isdelay){ if(isdelay){ $("#ani-wrapper").delay(500).animate({left:"-582px"},{duration:750,easing:"swing"}); }else{ $("#ani-wrapper").stop(true).animate({left:"-582px"},{duration:750,easing:"swing"}); } $("#loginbox input").val(""); } $("#msglogin").on("click",function(){ showmsg(); showloginmsg(true); }); $("#gologin").on("click",function(){ showloginmsg(false); }); /** * 弹出窗 * 注册 */ function showregmsg(isdelay){ if(isdelay){ $("#ani-wrapper").delay(500).animate({left:0},{duration:750,easing:"swing"}); }else{ $("#ani-wrapper").stop(true).animate({left:0},{duration:750,easing:"swing"}); } $("#regbox input").val(""); } $("#msgreg").on("click",function(){ showmsg(); showregmsg(true); }); $("#goreg").on("click",function(){ showregmsg(); }); /** * 合作品牌 * */ $("#brand li").hover(function(){ $(this).find("div.float-box").fadein(500); },function(){ $(this).find("div.float-box").fadeout(500); }); $("#index-service li").hover(function(){ $(this).find("a").stop(false,true).animate({color:"#c00"},{duration:500,easing:"swing"}); $(this).find("i").stop(false,true).animate({backgroundpositiony:"-227px"},{duration:500,easing:"easeoutexpo"}); },function(){ $(this).find("a").stop(false,true).animate({color:"#666"},{duration:500,easing:"swing"}); $(this).find("i").stop(false,true).animate({backgroundpositiony:"0px"},{duration:500,easing:"easeoutexpo"}); }); // 侧边烂鼠标悬浮效果 $("#side-nav li,#side-nav div.sys,#side-nav a.back").hover(function(){ var titlebox = $(this).find("div.title-box"); titlebox.show().stop(true).delay(150).animate({right:35,opacity:1},{duration:750,easing:"easeoutexpo"}); },function(){ var titlebox = $(this).find("div.title-box"); titlebox.stop(true).animate({right:90,opacity:0},{duration:350,easing:"swing",complete:function(){ titlebox.hide(); }}); }); // 文本框表单文字显隐 // // function inputfill(input){ // var oldval = input.val(); // input.focus(function(){ // if($.trim(input.val()) == oldval){ // input.val(""); // } // }); // // input.blur(function(){ // if($.trim(input.val()) == ""){ // input.val(oldval); // } // }); // } // // inputfill($("#seatxt")); // 跑马灯 function imgmar(speed,obj,par,hoverobj,wd){ var _lft =0, $par = $(par); function imgani(){ _lft--; if(_lft<=-wd){ _lft=0; $(obj).appendto(par); } $par.css('left',_lft+'px'); } //imgani(); $par.timer1 = setinterval(imgani,speed); $par.mouseenter(function(){ clearinterval($par.timer1); }) $(hoverobj).hover(function(){ clearinterval($par.timer1); },function(){ $par.timer1 = setinterval(imgani,speed); }) } $(function(){ imgmar(16,"#case-show li:first","#case-show","#mod div.mod_tab_con",400); imgmar(16,"#mod ul.con2 li:first","#mod ul.con2","#mod div.mod_tab_con",288); }) $("img").on("contextmenu",function(){ return false; }) $(document).keydown(function(e){ if(e.which == 123){ return false; } }) $("img").lazyload({ effect : "fadein", event:"scroll" }); });