$(document).ready(function () { //点击遮罩层 $(".h-opa").click(function () { $(".header").removeclass("menu-state") }) //点击菜单 $(".h-menu").click(function () { $(".header").addclass("menu-state") }) //点击搜索 // $(".h-search").click(function () { // $(".header").toggleclass("search-state") // $('.hs-text').focus() // }) $(".h-search").click(function (e) { if ($(this).parents('.header').hasclass("search-state")) { $(this).parents('.header').removeclass("search-state") $(this).parents('.header').find(".hs-a").slideup(300) } else { $(this).parents('.header').addclass("search-state") $(this).parents('.header').find(".hs-a").slidedown(300) $('.hs-text').focus() } }) //是否有二级菜单,有显示下拉箭头 $(".h-sub").each(function () { $(this).parents(".h-i").addclass("has-nav") }) $(".has-nav").mouseenter(function (e) { if ($(window).width() > 1200) { $(this).find(".h-sub").slidedown(300) } }) $(".has-nav").mouseleave(function () { if ($(window).width() > 1200) { $(this).find(".h-sub").stop().slideup(300) } }) $(".has-nav").click(function (e) { if ($(window).width() <= 1200) { e.preventdefault(); if ($(this).hasclass("show")) { $(this).removeclass("show") $(this).find(".h-sub").slideup(300) } else { $(this).addclass("show") $(this).find(".h-sub").slidedown(300) } } }) $(".h-sub_tow").each(function () { $(this).parents(".h-i").addclass("has-nav_tow") }) $(".has-nav_tow").mouseenter(function (e) { if ($(window).width() > 1200) { $(this).find(".h-sub_tow").slidedown(300) } }) $(".has-nav_tow").mouseleave(function () { if ($(window).width() > 1200) { $(this).find(".h-sub_tow").stop().slideup(300) } }) $(".has-nav_tow").click(function (e) { if ($(window).width() <= 1200) { e.preventdefault(); if ($(this).hasclass("show")) { $(this).removeclass("show") $(this).find(".h-sub_tow").slideup(300) } else { $(this).addclass("show") $(this).find(".h-sub_tow").slidedown(300) } } }) $(".h-j,.h-sub,.h-sub_tow").click(function (e) { e.stoppropagation() }) // 语言 $(".h-language").mouseenter(function (e) { if ($(window).width() > 1200) { $(this).find(".hl-list").slidedown(300) } }) $(".h-language").mouseleave(function () { if ($(window).width() > 1200) { $(this).find(".hl-list").stop().slideup(300) } }) $(".h-language").click(function (e) { if ($(window).width() <= 1200) { e.preventdefault(); if ($(this).hasclass("show")) { $(this).removeclass("show") $(this).find(".hl-list").slideup(300) } else { $(this).addclass("show") $(this).find(".hl-list").slidedown(300) } } }) $(".hl-list").click(function (e) { e.stoppropagation() }) $('.f-hint').click(function () { console.log(11); $(this).parents('.f-rt').toggleclass('show') }) // $(".nav").each(function () { // var l = $(this).find(".nav-item") // var n = l.length // var w = 100 / n + "%" // l.css("width", w) // }) // 入场动画 var hh = $(window).height() $(window).scroll(function (e) { var a = $(this).scrolltop() $(".teaser,.lter,.rter,.scale,.reduce").each(function () { var b = $(this).offset().top if (b - a < hh * 0.98 && b - a > -hh) { var el = $(this) el.addclass("is-visible") settimeout(function () { el.removeclass("is-visible teaser lter rter scale reduce").addclass("after") //如果原先有transition属性,为防冲突去掉这些类 }, 3000) } else { // $(this).removeclass("is-visible") } }) }) $(window).on("load", function () { $(window).trigger("scroll") }) //返回顶部 $("#backtop").click(function () { $("html,body").animate({ scrolltop: 0 }, 500, function () { }); }) //让ie9支持placeholder $('input, textarea').placeholder(); $(window).on("load", function () { // 自定义滚动条 $(".content").mcustomscrollbar({ autodraggerlength: true, }); }); $('.consult').click(function () { $('#nb_icon_wrap').trigger("click") }) })