$(function() { // 如果是苹果浏览器显示宋体 var issafariBrowser = /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent); if (issafariBrowser) { $('body').addClass('Safari'); $('body') .find('input') .addClass('Safari'); $('body') .find('select') .addClass('Safari'); } // 取消网站的右功能以及oncontextmenu菜单 function click(e) { if (document.all) { if (event.button == 2 || event.button == 3) { alert( '欢迎光临知心朋友,有什么需要帮忙的话,请与站长联系!谢谢您的合作!!!' ); oncontextmenu = 'return false'; } } if (document.layers) { if (e.which == 3) { oncontextmenu = 'return false'; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown = click; document.oncontextmenu = new Function('return false;'); //wowInt(); //searchOn(); /*if ($(window).width() > 1024) { sideBar(); }*/ phoneNav(); soluHeight(); public_ajax(); bim_slide(); his_slide(); share(); $(".wechat").click(function () { var url=$(this).data("img") var title="" title+="
" title+="x" title+="

官方微信

" title+="
" title+="

扫码关注

" title+="
" $("body").remove(".weixin"); $("body").append(title); }) $(document).on("click",".weixin-box .c",function(){ $(".weixin-box").remove(); }) $(window).scroll(function() { if ($(this).scrollTop() > 0) { $('body').addClass('scrollHeader'); } else { $('body').removeClass('scrollHeader'); } }); $('.banner>img').each(function() { if ($(window).width() > 768) { } else { ph_img = $(this).data('phone-src'); $(this).attr('src', ph_img); } }); $('.part-1 li .item img').each(function() { if ($(window).width() > 768) { } else { ph_img = $(this).data('phone-src'); $(this).attr('src', ph_img); } }); //PC一级导航 $('.nav>ul>li').hover( function() { //$(this).find(".child-box>ul li").addClass("on"); //$(this).find(".child-box>ul>li:first-child").addClass("on"); //$(this).find(".child-box>ul>li:first-child").find(".child-img").addClass("on"); if ( $(this) .find('.child') .size() <= 0 ) { $('.nav_bg').removeClass('on'); } else { $('.nav_bg').addClass('on'); $(this) .addClass('on') .siblings() .removeClass('on'); //$(this).find(".child-box>ul li").addClass("on"); $(this) .find('.child-imglist ul li') .addClass('on'); $(this) .find('.child-box>ul>li:first-child') .addClass('on'); $(this) .find('.child-box>ul>li.has_sub dl>dd:first-child') .addClass('on'); $(this) .find('.child-box>ul>li:first-child') .find('.child-img') .addClass('on'); } }, function() { $(this).removeClass('on'); $('.nav_bg').removeClass('on'); $(this) .find('li') .removeClass('on'); $(this) .find('.child-imglist ul li') .removeClass('on'); } ); /*$(".nav>ul>li").click(function(){ if(!$(this).hasClass("on")){ $(this).addClass("on").siblings().removeClass("on"); $(this).find(".child-imglist ul li").addClass("on"); $(this).find(".child-box>ul>li").removeClass("on"); //$(this).find(".child-box>ul>li:first-child").addClass("on"); //$(this).find(".child-box>ul>li:first-child").find(".child-img").addClass("on"); $(this).find(".child-box>ul>li:first-child dl dd").removeClass("on"); $(this).find(".child-box>ul>li:first-child dl dd:first-child").addClass("on"); } else{ $(this).removeClass("on"); } })*/ $('.nav_bg').hover( function() {}, function() { $(this).removeClass('on'); } ); //PC二级导航 $('.child-box>ul>li').hover(function() { $(this).addClass('on'); $(this) .siblings('li') .removeClass('on'); if ($(this).find('dl').length > 0) { $(this) .find('.child-img') .removeClass('on'); } else { $(this) .find('.child-img') .addClass('on'); } }); //PC三级导航 $('.child-box>ul>li.has_sub dl>dd').hover(function() { $(this).addClass('on'); $(this) .siblings('dd') .removeClass('on'); }); var mySwiper = new Swiper('.case_slides .swiper-container', { autoplay: 5000, //可选选项,自动滑动 slidesPerView: 3, slidesPerGroup: 1, spaceBetween: 2, prevButton: '.case_slides .swiper-button-prev', nextButton: '.case_slides .swiper-button-next', //observer: true,//修改swiper自己或子元素时,自动初始化swiper //observeParents: true,//修改swiper的父元素时,自动初始化swiper breakpoints: { 480: { slidesPerView: 1, spaceBetween: 10 } } }); if ($('.case_slides .swiper-slide').size() <= 3) { $( '.case_slides .swiper-button-prev,.case_slides .swiper-button-next' ).hide(); } $('.service-part02 li .txt').height($('.service-part02 li .img').height()); $('.service-part02 li .txt .c').mCustomScrollbar(); //$(".his_con dd").mCustomScrollbar(); $('.about-part01 span.more').click(function() { if ($(this).hasClass('s_show')) { $(this) .parents('.about-part01') .find('.hide_more') .addClass('on'); $(this) .find('em') .text('点击收起'); $(this).removeClass('s_show'); } else { $(this) .parents('.about-part01') .find('.hide_more') .removeClass('on'); $(this) .find('em') .text('了解更多'); $(this).addClass('s_show'); } }); //--------------tab-box /*$(".tab-box .tab-a").each(function() { $(this).click(function() { $(this).addClass("on").siblings().removeClass("on"); var ii=$(this).index(); //$.getScript("../js/ratio-img.js"); $(this).parents(".tab-box").find(".tab-b").eq(ii).show().siblings().hide(); }); }) $(".tab-box").each(function (i) { $(this).find(".tab-a:eq(0)").click(); });*/ //end }); function share(){ $(".share_wb").click(function () { var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://service.weibo.com/share/share.php?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op) }) $(".share_qq").click(function () {//QQ var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "http://connect.qq.com/widget/shareqq/index.html?url=" + encodeURIComponent(url) + ""; window.open(op); }) $(".share_douban").click(function () {//豆瓣 var url = $(this).data("txt"); var url = window.location.href; var title = document.title; var op = "https://www.douban.com/share/service?title=" + title + "&url=" + encodeURIComponent(url) + ""; window.open(op); }) //微信 $(".share_wx").attr("data-qrcode", "/qrCode/Index.aspx?url=" + window.location.href); $(".share_wx").click(function () {//微信 //var url = "/qrCode/Index.aspx?url=" + window.location.href; var url = $(this).attr("data-qrcode") console.log(url) var title = "" title += "
" title += "x" title += "

二维码

" title += "
" title += "

扫一扫

" title += "
" $("body").remove(".weixin"); $("body").append(title) }) $(document).on("click", ".weixin .c", function () { $(".weixin").remove(); }) } /* 手机导航 */ function phoneNav() { $(document).on('click', '.nav_phone_btn,.nav_phone_tit .button', function() { $('.nav_phone_con>ul>li').removeClass('on'); $('.nav_phone_btn').toggleClass('visible_nav'); $('body').toggleClass('body_nav_phone'); }); $('.nav_phone_con>ul>li>a').click(function() { var _pa = $(this).parent(); if (_pa.hasClass('on')) { _pa.removeClass('on'); } else { _pa.addClass('on'); _pa.siblings().removeClass('on'); } }); $('.nav_phone_con>ul>li dl dd > a.back').click(function() { $(this) .parents('li') .removeClass('on'); }); $('.nav_phone_con>ul>li> dl dd span').click(function() { var _pa = $(this).parent(); if (_pa.hasClass('on')) { _pa.removeClass('on'); } else { _pa.addClass('on'); _pa.siblings().removeClass('on'); } }); $('.nav_phone_con>ul>li dl dd .three a.back').click(function() { $(this) .parents('dd') .removeClass('on'); }); } /* end */ //大事记切换 function his_slide() { var _ind = 0; var _len = $('.his_year .swiper-slide').length; var tc_box_Swiper = new Swiper('.his_year .swiper-container', { slidesPerView: 9, spaceBetween: 0, direction: 'vertical', prevButton: '.his_year .swiper-button-prev', nextButton: '.his_year .swiper-button-next', breakpoints: { 767: { slidesPerView: 4, direction: 'horizontal' } } }); btnJudge(); $('.his_year .swiper-slide').click(function() { _ind = $(this).index(); btnJudge(); //var url = $(this).data("src"); $(this) .addClass('on') .siblings() .removeClass('on'); //caseAjax(".his_con",url) }); $('.his_year .swiper-button-prev').click(function() { _ind--; btnJudge(); $('.his_year .swiper-slide') .eq(_ind) .addClass('on') .siblings() .removeClass('on'); $('.his_year .swiper-slide.on').click(); }); $('.his_year .swiper-button-next').click(function() { _ind++; btnJudge(); $('.his_year .swiper-slide') .eq(_ind) .addClass('on') .siblings() .removeClass('on'); $('.his_year .swiper-slide.on').click(); }); $('.his_year .swiper-slide:first-child').click(); function btnJudge() { if (_ind >= _len - 1) { $('.his_year .swiper-button-next').addClass('disabled'); _ind = _len - 1; } else { $('.his_year .swiper-button-next').removeClass('disabled'); } if (_ind <= 0) { $('.his_year .swiper-button-prev').addClass('disabled'); _ind = 0; } else { $('.his_year .swiper-button-prev').removeClass('disabled'); } } } //ajax切换页面 function caseAjax(str, url) { $.ajax({ url: url, success: function(msg) { $(str).html(''); $(str).append(msg); } }); } //BIM选项卡切换 function bim_slide() { var _ind = 0; var _len = $('.bim-b-t .swiper-slide').length; if (_len <= 0) { $('.bim-box').hide(); } else { var proSwiper = new Swiper('.bim-b-t .swiper-container', { slidesPerView: 5, spaceBetween: 1, prevButton: '.bim-b-t .swiper-button-prev', nextButton: '.bim-b-t .swiper-button-next', observer: true, observeParents: true, breakpoints: { 768: { slidesPerView: 2 } } }); if ($('.bim-b-t .swiper-slide').size() <= 5) { $('.bim-b-t .swiper-button-prev,.bim-b-t .swiper-button-next').hide(); } $('.bim-b-t .swiper-button-prev').addClass('disabled'); $('.bim-b-t .swiper-button-prev').click(function() { _ind--; $('.bim-b-t .swiper-button-next').removeClass('disabled'); if (_ind <= 0) { $(this).addClass('disabled'); _ind = 0; } else { $(this).removeClass('disabled'); } $('.bim-b-t .swiper-slide') .eq(_ind) .addClass('on') .siblings() .removeClass('on'); $('.bim-b-c ul li') .eq(_ind) .show() .siblings() .hide(); }); $('.bim-b-t .swiper-button-next').click(function() { _ind++; $('.bim-b-t .swiper-button-prev').removeClass('disabled'); if (_ind >= _len - 1) { $(this).addClass('disabled'); _ind = _len - 1; } else { $(this).removeClass('disabled'); } $('.bim-b-t .swiper-slide') .eq(_ind) .addClass('on') .siblings() .removeClass('on'); $('.bim-b-c ul li') .eq(_ind) .show() .siblings() .hide(); }); $('.bim-b-t .swiper-slide:eq(0)').click(); $('.bim-b-t .swiper-slide:eq(0)').addClass('on'); $('.bim-b-t .swiper-slide').click(function() { $(this) .addClass('on') .siblings() .removeClass('on'); _ind = $(this).index(); $('.bim-b-c ul li') .eq(_ind) .show() .siblings() .hide(); }); } } //解决方案-高度 function soluHeight() { if ($(window).width() > 767) { var h_max = 0; $('.solu-part02 li').each(function() { var h = $(this).height(); h_max = h > h_max ? h : h_max; }); $('.solu-part02 li').height(h_max); } } //解决方案-加载更多 function public_ajax() { if ($('.ajLoad').length > 0) { var $resourceTypeList = $('.ajLoad ul'); $resourceTypeList.infinitescroll( { navSelector: '#public_more', nextSelector: '#public_more a', itemSelector: '.public_li', clickb: true, clickobj: '.public_load-more-link', loading: { img: '../images/loading.gif', msgText: ' ', finishedMsg: '', finished: function() { $('#infscr-loading').hide(); //$.getScript('../js/ratio-img.js'); imgratio(); } }, errorCallback: function() { //$(".public_load-more-link").after("
没有了
"); $('.public_load-more-link').hide(); setTimeout(function() { $('.finMessage').fadeOut(); }, 500); } }, function(newElements) { var $newElems = $(newElements); $newElems.fadeIn(); return; } ); } } function wowInt() { if (!/msie [6|7|8|9]/i.test(navigator.userAgent)) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: -100, mobile: false, live: true }); wow.init(); } } /* 搜索框 */ function searchOn() { $( '.header .pc-search img,.header .pc-search input,.header .pc-search i' ).click(function(e) { e.stopPropagation(); $('.search').addClass('on'); }); $(document).click(function() { $('.header .pc-search').removeClass('on'); }); } /* end */ /* 侧边栏 */ function sideBar() { $(window).scroll(function() { if ($(this).scrollTop() >= 200) { $('.sidebar').fadeIn(); } else { $('.sidebar').fadeOut(); } }); $('.sidebar .item5 .box').click(function(e) { e.stopPropagation(); var top = $('html,body').scrollTop(); $('html,body').animate({ scrollTop: '0px' }); }); } /* end */ /*模拟下拉*/ function select() { $('.select-box').each(function(i) { $(this) .find('dt') .click(function(e) { e.preventDefault(); e.stopPropagation(); var el = $(this).parent('.select-box'); if (el.hasClass('open')) { el.removeClass('open'); } else { el.addClass('open'); el.parents('.sel_box') .siblings('.sel_box') .find('.select-box') .removeClass('open'); } }); $('.select-box') .eq(i) .find('dd a') .each(function(x) { $(this).click(function() { var inde = $(this).index(); $(this) .addClass('on') .siblings() .removeClass('on'); var el = $('.select-box.open'); el.next('.select-hidden').val($(this).attr('data-val')); el.find('dt a').text($(this).text()); el.find('dd a') .eq(inde) .addClass('on') .siblings() .removeClass('on'); setTimeout(function() { el.removeClass('open'); }, 1); }); }); }); $(document).click(function() { $('.select-box.open').removeClass('open'); }); } /* end */ $(function() { if ($(window).width() > 768) { $('.solu-partbox').each(function() { if ($(this).find('.inwrap>ul>li').length <= 3) { $(this).addClass('on'); } }); } });