var links = { init: function() { this.setdown(); }, setdown: function() { $(".bottomnavright span").click(function() { $(this).stop().toggleclass('on'); $(this).parents('.bottomnavright').find('.friends').stop().slidetoggle(); }); $(".bottomnavright").mouseleave(function() { $(this).find('span').removeclass('on'); $(this).find(".friends").stop().slideup(); }) } }; links.setdown(); $(".responsivenavbtn,.navmask").click(function() { closeright(); // 关闭所有li $('.responsive-style').removeclass('on'); $('.responsive-style').removeclass('selected'); $('.responsive-ol').hide(); }); function closeright() { $(".responsivenav,.responsivenavbtn").toggleclass('active'); //点击添加删除active $(".navmask").fadetoggle(); //自带淡入淡出样式 } $(".responsive-ul >li >a").bind("click", function(e) { var $navmobile = jquery(".responsivebox"), $nava = $navmobile.find(".responsive-ul >li >a"), $msubnav = $navmobile.find(".responsive-ol"); var hjcur = $(this); var hjdd = $(this).parents("li"); if(hjdd.find(".responsive-ol").size() > 0) { if(hjdd.hasclass("on")) { // $(".header").removeclass('show'); hjdd.find(".responsive-ol").stop(false, false).slideup(); hjdd.removeclass("on"); } else { $nava.parents('li').removeclass("on"); $msubnav.stop(false, false).slideup(); hjdd.find(".responsive-ol").stop(false, false).slidedown(); hjdd.addclass("on"); e.preventdefault(); } } }); var ismobile = false, mobile = false, win_width = 0, win_height = 0, ath =80; var pageinit = { init: function () { win_width = $(window).width(); win_height = $(window).height(); if (win_width <= 1024) { ismobile = true; ath =80; } else if (win_width > 1024) { ismobile = false; ath =80; }; }, setimgmax: function (img, imgw, imgh, tw, th) { var twidth = tw || win_width; var theight = th || win_height; var coe = imgh / imgw; var coe2 = theight / twidth; if (coe < coe2) { var imgwidth = theight / coe; img.css({ height: theight, width: imgwidth, left: -(imgwidth - twidth) / 2, top: 0 }); } else { var imgheight = twidth * coe; img.css({ height: imgheight, width: twidth, left: 0, top: -(imgheight - theight) / 2 }); }; } } jquery(window).resize(function () { pageinit.init(); }); pageinit.init(); var $banner=jquery(".banner-box"), $banneritem=jquery(".banner-box .banner-body"), $bannerimg=jquery(".banner-box .pimg"), $bannerimgs=$(".banner-public"), $bannerinn=$(".public-banner"); function initpro(){ if(!ismobile){ $banner.css({height:win_height-80}); $banneritem.css({height:win_height-80}); $bannerinn.css({height:win_height-80}); pageinit.setimgmax($bannerimg,1920,870,win_width,win_height-80); pageinit.setimgmax($bannerimgs,1920,950,win_width,win_height-80); }else{ $banner.css({height:"auto"}); $banneritem.css({height:"auto"}); $bannerimg.attr("style","").css({position: "relative"}); } } initpro(); jquery(window).resize(function () { initpro(); }); //$(function() { // var index_=$(".lift-nav li.current").index(); // console.log(index_); // $(".public-bttom-body li").hover(function() { // $(this).addclass('current').siblings('li').removeclass('current'); // 删除其他兄弟元素的样式 // },function(){ // $(".public-bttom-body li").removeclass('current').eq(index_).addclass('current'); // }); //}); $(function() { var index_=$(".publicnavigationbox li.active").index(); $(".publicnavigationbox li").hover(function() { $(this).addclass('active').siblings('li').removeclass('active'); // 删除其他兄弟元素的样式 },function(){ $(".publicnavigationbox li").removeclass('active').eq(index_).addclass('active'); }); }); $(function() { var index_=$(".public-paging-ul li a.active").index(); console.log(index_); $(".public-paging-ul li").hover(function() { $(this).addclass('active').siblings('li').children('a').removeclass('active'); // 删除其他兄弟元素的样式 },function(){ $(".public-paging-ul li").children('a').removeclass('active').eq(index_).addclass('active'); }); }); //滚动监听 // json指在index页面传递过来的对象 function lifteffect(json){ //定义一个数组 var array=[]; // json.target.length是指index传过来的对象中,名字为target的值的长度 "target": [".t1",".t2",".t3",".t4",".t5",".t6"] for(var i =0; i= newactive){ // 淡入效果来显示一个隐藏元 $(json.control1).addclass('position-fixed'); } else{ // 淡出效果来隐藏一个显示元素 $(json.control1).removeclass('position-fixed'); } var key =0; var flag = true; for(var i =0; i= array[array.length-key]-300){ var index = array.length-key; flag = false; }else{ flag=true; } } } selected(index); } //点击电梯某一层触发 $(json.control2).children().on("click",function(){ // 移除$(window)元素上的 scroll事件 $(window).off("scroll"); var index = $(this).index(); selected(index); $(json.control1).addclass('position-fixed'); var flag = true; for(var i =0; i=1){ e.preventdefault(); jquery("html,body").animate({ scrolltop: jquery("."+hash).offset().top-jquery(".header").height()},800,'easeinoutexpo'); } }); //jquery(".mailbox__pop2").click(function(e){ // $(".pop-mailbox2").addclass("show"); //}); jquery(".mailbox__pop1").click(function(e){ $(".pop-mailbox1").addclass("show"); }); jquery(".popbg,.close__btn").click(function(e){ $(".pop-mailbox").removeclass("show"); }); jquery(".vwrap .close,.vwrap .videobtg").click(function () { jquery(".vwrap").hide(); $('#videobox').html(""); });