/*global jquery:false */ jquery(document).ready(function($) { //导航菜单 $("#menuok").click(function(){ $(".navlink_right").toggle(); $(".sjmenu").toggle(); var menu_t = $(this).attr("src"); var menu_t1="/home/img/menu_close.png"; var menu_t2="/home/img/menuok.png"; if (menu_t==menu_t1){ $(this).attr("src",menu_t2); }else{ $(this).attr("src",menu_t1); } }); // 商业联盟 $("#wdyhok").click(function(){ $("#sjjs").hide(); $("#wdyh").show(); }); // 商业联盟 $("#sjjsok").click(function(){ $("#wdyh").hide(); $("#sjjs").show(); }); //项目购房登记 置业顾问 360°全景,图片显示 $(".project_title_icon a").on("mouseover mouseout",function(event){ var project_title_img = $(this).children("p").children("img").attr("altr"); var project_title_img1 = $(this).children("p").children("img").attr("altrok"); if(event.type == "mouseover"){ //鼠标悬浮 $(this).children("p").children("img").attr("src",project_title_img); }else if(event.type == "mouseout"){ //鼠标离开 $(this).children("p").children("img").attr("src",project_title_img1); } }); //首页新闻 点击图标事件 $(".i_news_title2 ul li").click(function(){ $(".i_news_l").css("display","none"); $(".i_right .i_news_title1 a").css("display","none"); $(".i_news_title2 ul li").removeclass("c"); $(this).addclass("c"); var homeshowtile=$(this).attr("alt"); $("#"+homeshowtile).css("display","block"); $("#m_"+homeshowtile).css("display","block"); }) ; //首页新闻 经过图标事件 $(".i_news_title2 ul li").mouseover(function(){ $(".i_news_l").css("display","none"); $(".i_right .i_news_title1 a").css("display","none"); $(".i_news_title2 ul li").removeclass("c"); $(this).addclass("c"); var homeshowtile=$(this).attr("alt"); $("#"+homeshowtile).css("display","block"); $("#m_"+homeshowtile).css("display","block"); }); //企业文化简介 点击图标事件 $(".culture_wh ul li").click(function(){ $(".culture_wh_01").css("display","none"); $(".culture_wh ul li").removeclass("c"); $(this).addclass("c"); var homeshowtile=$(this).attr("alt"); $("#"+homeshowtile).css("display","block"); }) ; //企业文化简介 经过图标事件 $(".culture_wh ul li").mouseover(function(){ $(".culture_wh_01").css("display","none"); $(".culture_wh ul li").removeclass("c"); $(this).addclass("c"); var homeshowtile=$(this).attr("alt"); $("#"+homeshowtile).css("display","block"); }); //项目介绍 区位配套 点击图标事件 $(".project_map_right ul li").click(function(){ $(".project_map_show").css("display","none"); $(".project_map_right ul li").removeclass("flist"); $(this).addclass("flist"); var homeshowtile=$(this).attr("alt"); $("#"+homeshowtile).css("display","block"); }) ; //项目介绍 区位配套 经过图标事件 $(".project_map_right ul li").mouseover(function(){ $(".project_map_show").css("display","none"); $(".project_map_right ul li").removeclass("flist"); $(this).addclass("flist"); var homeshowtile=$(this).attr("alt"); $("#"+homeshowtile).css("display","block"); }); //bootstrap图片广告切换速度 $('.carousel').carousel({ interval: 4000 }); //bootstrap图片广告切换速度 $('.carousel2').carousel({ interval: 3000 }); //首页浮动广告 var $body = $(document.body);; var $bottomtools = $('.bottom_tools'); var $qrtools = $('.qr_tool'); var qrimg = $('.qr_img'); $(window).scroll(function () { var scrollheight = $(document).height(); var scrolltop = $(window).scrolltop(); var $footerheight = $('.page-footer').outerheight(true); var $windowheight = $(window).innerheight(); //scrolltop > 50 ? $("#scrollup").fadein(200).css("display","block") : $("#scrollup").fadeout(200); $bottomtools.css("bottom", scrollheight - scrolltop - $footerheight > $windowheight ? 40 : $windowheight + scrolltop + $footerheight + 40 - scrollheight); }); //$('#scrollup').click(function (e) { // e.preventdefault(); // $('html,body').animate({ scrolltop:0}); // }); $qrtools.hover(function () { qrimg.fadein(); }, function(){ qrimg.fadeout(); }); //列表自适应 var ptlistwrp = $('.jq_ptlst'); //列表容器 var vallstliwth = $('.jq_ptlst li').width(); //图片宽度(图片可能包括边框样式等,取li宽度参与可视图片计算避免误差) var valimglth = 1; //可见图数变量* var valplstmg = 0; //边距变量* var plstlesmg = 5; //临界间距 //列表滚动 var plstrolt = $('.jq_plstrolt'); //左滚动元素 var plstrort = $('.jq_plstrort'); //右滚动元素 var plstimglth = ptlistwrp.find('li').length; //获取图片总数 //宽度自适应方法 function fnautowth(){ //重置滚动 $('.jq_ptlst ul').css({'marginleft':'0'}); //plstrolt.hide(); /// plstrort.show(); var plstwrpwth = ptlistwrp.width(); //获取当前可视区域宽度 valimglth = math.floor(plstwrpwth / vallstliwth); ///当前可视图片数计算* //图片间距算法 function fnplstmg(){ //间距 = 除去图片的宽度 /(图片数 + 1),并向上取整(避免小数误差) valplstmg = math.ceil((plstwrpwth - valimglth * vallstliwth) / (valimglth + 1)); }; //执行计算 fnplstmg(); //间距临界值 if(valplstmg < plstlesmg){ valimglth = valimglth - 1; //当间距达到临界值,图片数-1 fnplstmg(); //重新计算间距 }; //可视图片数 >= 总图片数时,总图片数即可视图片数 if(valimglth >= plstimglth){ valimglth = plstimglth; fnplstmg(); //重新计算间距 //plstrort.hide(); }; //使可视图不为0 // if(valimglth == 0){ // valplstmg = 5; // }; //设置间距 ptlistwrp.find('li').css('margin-left',valplstmg); }; //初始执行宽度自适应方法 fnautowth(); //动态变化宽度时执行方法 $(window).resize(function(){ fnautowth(); //宽度自适应方法 }); //滚动方法 function fnplstarr($this){ var plstrowrp = ptlistwrp.find('ul'); var ptlstcssmg = parseint(plstrowrp.css('margin-left')); //获取当前已滚动宽度 var ptlstimgmg = parseint(plstrowrp.find('li:first').css('margin-left')); //获取当前图片间距 //向右滚动 if($this.hasclass('jq_plstrort')){ //当点击右箭头时,列表向左滚动。需滚动的宽度 = 当前图片间距 + 图片宽度(取li宽度) plstrowrp.not(':animated').animate({marginleft: ptlstcssmg - (ptlstimgmg + vallstliwth)},200,function(){ //回调函数判断滚动之后的箭头状态 var ptlstcurmg = parseint(plstrowrp.css('margin-left')); //获取当前已滚动宽度 var ptlstrowth = (plstimglth - valimglth) * (ptlstimgmg + vallstliwth);//计算非可视区域宽度 //当已滚动宽度 = 非可视区宽度,即已滚动至最后一图 if(ptlstcurmg + ptlstrowth == 0){ //$this.hide(); //隐藏右箭头 }; //plstrolt.show(); //一旦向右滚动,左箭头即显示 }); }; //向左滚动 if($this.hasclass('jq_plstrolt')){ plstrowrp.not(':animated').animate({marginleft: ptlstcssmg + (ptlstimgmg + vallstliwth)},200,function(){ //回调函数判断滚动之后的箭头状态 var ptlstcurmg = parseint(plstrowrp.css('margin-left')); //获取当前已滚动宽度 var ptlstrowth = (plstimglth - valimglth - 1) * (ptlstimgmg + vallstliwth);//计算非可视区域宽度 //当已滚动宽度 = 0,即已滚动至最前一图 if(ptlstcurmg == 0){ // $this.hide(); //隐藏左箭头 }; //plstrort.show(); //一旦向左滚动,右箭头即显示 }); }; }; //滚动事件绑定 $('.jq_plstrolt, .jq_plstrort').click(function(){ fnplstarr($(this)); }); //荣誉事件绑定 $(".plst_pt li").click(function(){ $(".history_show").css("display","none"); $("a").filter(".phover").removeclass("phover");; $(this).children("a").addclass("phover"); var tewi=$(this).attr("alt"); $("#"+tewi).css("display","block"); }) //招聘事件绑定 $(".join_list dl dd").click(function(){ $(this).toggleclass("join_list1"); $(this).children(".postdel").toggle(); }) $(".xjoin_list dl dd").click(function(){ $(this).toggleclass("join_list2"); $(this).children(".postdel").toggle(); }) //.. });