// JavaScript Document gsap.registerPlugin(ScrollTrigger); $('#gotop').click(function () { gsap.to(window, { duration: 1, scrollTo: '0' }); $("#gotop").addClass("hide"); }); $(function(){ setTimeout(function () { $("#loading").fadeOut(); AOS.init({ duration: 1200, disable: 'mobile', //easing: 'ease-out-back', //once:1, }); }, 500); var agent = navigator.userAgent; if (/.*Firefox.*/.test(agent)) { document.addEventListener("DOMMouseScroll", function(e) { e = e || window.event; var detail = e.detail; if (detail > 0) { console.log("鼠标向下滚动"); $(".header").removeClass("on1"); } else { console.log("鼠标向上滚动"); $(".header").addClass("on1"); } }); } else { document.onmousewheel = function(e) { e = e || window.event; var wheelDelta = e.wheelDelta; if (wheelDelta > 0) { console.log("鼠标向上滚动"); $(".header").addClass("on1"); } else { console.log("鼠标向下滚动"); $(".header").removeClass("on1"); } } } setTimeout(function () { $(".online_q").slideUp(); $(".rightBtn_box").hover(function() { $(".online_q").stop().slideDown(); }, function() { $(".online_q").stop().slideUp(); }); }, 10000); $(window).scroll(function() { if ($(this).scrollTop()>0){ $(".header").addClass("on"); }else{ $(".header").removeClass("on"); }; if ($(this).scrollTop()>100){ $("#gotop").removeClass("hide"); }else{ $("#gotop").addClass("hide"); }; }); $(".topnav ul li i.plus").click(function () { $(this).toggleClass('show').next().slideToggle(); $(this).parent().siblings('li').find('.plus').removeClass('show').next().slideUp() }) $('.navbtn').click(function () { $('body').toggleClass('navShow'); }); $('#openBtn').click(function () { $('.site-menu').toggleClass('site-menu-is-open'); }); $(".site-menu-close").click(function () { $('.site-menu').removeClass('site-menu-is-open'); }); $(".showSear").click(function () { $(".ser-layer").addClass('showdiv'); //$('body').removeClass('navShow'); }) $(".serclose").click(function () { $(".ser-layer").removeClass('showdiv'); }); $(".ar_article table").wrap('
');//表格外添加div $('.tc_btn[name]').click(function() { var tf_name_id = $(this).attr('name'); $('.tc[name=' + tf_name_id + ']').addClass('act'); }); $('.tc_close').click(function() { $(this).parents('.tc').removeClass('act'); }); $('.tc_bg').click(function() { $(this).parents('.tc').removeClass('act'); }); //移动端导航 $(".list_box_nav_mobile>li i").click(function(){ $(this).parents(".list_box_nav_mobile>li").find(".box").slideToggle(); $(this).parents(".list_box_nav_mobile>li").toggleClass("on1"); $(this).parents(".list_box_nav_mobile>li").siblings().find(".box").slideUp(); $(this).parents(".list_box_nav_mobile>li").siblings().removeClass("on1"); }); /*$("#m_nav .sub").hide(); $("#m_nav .void").click(functon(){ $(this).children(".sub").slideToggle(); //展开 });*/ $("#nav_btn_box").click(function(){ $("#nav_btn_box .point").toggleClass("on"); $("#nav_btn_box").toggleClass("on"); $("#m_nav").toggleClass("act"); $(".nav_mask").fadeToggle(); $("body").toggleClass("navShow"); }); $(".nav_mask").click(function(){ $("#nav_btn_box .point").removeClass("on"); $("#nav_btn_box").removeClass("on"); $(this).fadeToggle(); $(".nav_btn_box").removeClass("act"); $("#m_nav").removeClass("act"); }) $("#m_nav .close").click(function(){ $("#nav_btn_box .point").removeClass("on"); $("#nav_btn_box").removeClass("on"); $(".nav_btn_box").removeClass("act"); $("#m_nav").removeClass("act"); $(".nav_mask").fadeOut(); }); //移动端内页导航 $("#bnt_sub_nav").click(function(){ $(this).toggleClass("on"); $("#sub_nav_content").slideToggle(); }); $("#sub_nav_content dt.title a").attr("href","javascript:void(0)"); $("#sub_nav_content dt.title_on").next("dd").show(); $("#sub_nav_content dt.title").click(function() { if ($(this).hasClass("title_on")) { $(this).next("dd").slideToggle(); $(this).removeClass("title_on"); } else { $("#sub_nav_content dd").slideUp(); $("#sub_nav_content dt.title").removeClass("title_on").removeClass("on"); $(this).toggleClass("title_on"); $(this).next("dd").slideDown(); } }); //IE9 兼容placdholder属性 function placeholderSupport() { return 'placeholder' in document.createElement('input'); } if(!placeholderSupport()){ // 判断浏览器是否支持 placeholder $("[placeholder]").each(function(){ var _this = $(this); // console.log($(this).height()); var inputHeight = parseInt(parseInt($(this).height()-2)-14)/2; var inputHeight = parseInt(parseInt(parseInt($(this).height()-2)/2)-7)+'px'; _this.parent().css({"position": "relative"}); var left = _this.position().left+parseInt(_this.css("padding-left"))+parseInt(_this.css("margin-left"))+"px"; var top = parseInt(_this.css("padding-top"));//+parseInt(_this.css("margin-top"))+"px"; var top = parseInt(_this.css("padding-top"));//+parseInt(_this.css("margin-top"))+"px"; _this.after('' + _this.attr("placeholder") + ''); //_this.after('' + _this.attr("placeholder") + ''); if(_this.val() != ""){ _this.parent().find("span.placeholder").hide(); } else{ _this.parent().find("span.placeholder").show(); } }).on("focus", function(){ $(this).parent().find("span.placeholder").hide(); }).on("blur", function(){ var _this = $(this); if(_this.val() != ""){ _this.parent().find("span.placeholder").hide(); } else{ _this.parent().find("span.placeholder").show(); } }); // 点击表示placeholder的标签相当于触发input $("span.placeholder").on("click", function(){ $(this).hide(); $(this).siblings("[placeholder]").trigger("click"); $(this).siblings("[placeholder]").trigger("focus"); }); } // $('a').click(function(e) { // e.preventDefault(); // 阻止默认行为 // var href = $(this).attr('href'); // if (href !== 'javascript:;') { // window.open(href, '_blank'); // } // }); });