$(function () { //加载动画 if (__m.cssanimations) { new kyanimate().init(); } else { $('.ky'), css("visibility", "visible"); } var c_headerlogo = $("#c_headerlogo").val(); //header样式 $('.header_p').addclass("header_p_active"); $('.headernav>a').addclass("header_nav_black"); $('.lastli').addclass("header_nav_black"); $('.glass').addclass("glass_active"); $('.phone').addclass("phone_active"); $('.logo').attr("src", c_headerlogo); $('.headernav').hover( function () { let this_ = $(this); this_.children().eq(0).addclass("header_nav_red"); this_.children('.menu').stop().slidedown(200); }, function () { let this_ = $(this); this_.children().eq(0).removeclass("header_nav_red"); // console.log($(this).index()); this_.children('.menu').stop().slideup(200); } ) $(".menu .box-right .list .item").hover( function () { var index = $(this).index(); $(".menu .box-right .list .item-bg").css({ 'top': index * 0.525 + 'rem' }); }, function () { $(".menu .box-right .list .item-bg").css({ 'top': '-0.525rem' }); } ); $('.language-box').hover( function () { let $this = $(this); $this.children('.down-box').stop(true, false).slidedown(500); }, function () { let $this = $(this); $this.children('.down-box').stop(true, false).slideup(200); } ); $('.links .text-show').click(function () { $('.links .link').stop(false, true).slidetoggle(388); }) $__w.click(function (e) { $this = $(e.target); if (!$(".links .link").is(":hidden") && !$this.hasclass("text-show") && !$this.hasclass("text") && !$this.hasclass("icon")) { $(".links .link").stop(false, true).hide(388, "easeinquart"); } }); //header搜索框 $('.glass').on('click', function () { $('.search_box').slidedown(500); }) $('.close').on('click', function () { $('.search_box').slideup(500); }) //m_herader样式 var flag = false; $('.logo').attr("src",c_headerlogo); $('.head_top').addclass("head_top_active"); $('.head_right i').addclass("i_active"); $('#menus').on('click', function () { if (!flag) { $('#menus').removeclass("fa-bars").addclass("fa-times"); $('.mhead_li').slidedown() flag = true; } else { $('#menus').removeclass("fa-times").addclass("fa-bars"); $('.mhead_li').slideup() flag = false; } }) $('.li_left li').on('click', function () { let index = $(this).index(); $(this).addclass('li_active').siblings().removeclass('li_active'); $('.li_right>ul').eq(index).addclass("ul_active").siblings().removeclass("ul_active") }) //手机搜索框 $('#search').on('click', function () { $('.m_search').slidedown(200); }) $('.m_close').on('click', function () { $('.m_search').slideup(200); }) //tab切换 $('.select>div').on('click', function () { let this_ = $(this); this_.addclass("se_active").siblings().removeclass("se_active") if (this_.hasclass("se_active")) { this_.children(".bot").css({ "display": "block" }); this_.siblings().children(".bot").css({ "display": "none" }); } if (this_.index() == 0) { $('.inp2').hide().siblings().show() } else { $('.inp1').hide().siblings().show() } }) //select框 $('.country-box').click(function () { $this = $(this) $(this).siblings('ul').stop(true, true).slidetoggle(); $this.find('.icon').toggleclass('xz') }) $('body').on("click",'.country ul li',function () { // $('.country ul li').click(function () { $this = $(this) $this.parents('ul').stop(true, true).slidetoggle(); $('.country-value').text($this.text()) $('.country-box').find('.icon').toggleclass('xz') }) $('.province-box').click(function () { $this = $(this) $(this).siblings('ul').stop(true, true).slidetoggle(); $this.find('.icon').toggleclass('xz') }) $('body').on("click",'.province ul li',function () { // $('.province ul li').click(function () { $this = $(this) $this.parents('ul').stop(true, true).slidetoggle(); $('.province-value').text($this.text()) $('.province-value').attr('data-src',$this.data("val")) $('.province-box').find('.icon').toggleclass('xz') }) $('.city-box').click(function () { $this = $(this) $(this).siblings('ul').stop(true, true).slidetoggle(); $this.find('.icon').toggleclass('xz') }) $('body').on("click",'.city ul li',function () { // $('.city ul li').click(function () { $this = $(this) $this.parents('ul').stop(true, true).slidetoggle(); $('.city-value').text($this.text()) // $('.city-value').text($this.text()) $('.city-value').attr('data-src',$this.data("val")) $('.city-box').find('.icon').toggleclass('xz') }) //重置 $('.reset2').on('click', function () { $('.city-value').text('市 / 县'); $('.province-value').text('省 / 自治区 / 直辖市 / 特区'); $('.country-value').text('国内 / 国外') }) $('.reset1').on('click', function () { // console.log($('.inp1 input')[0].value); $('.inp1 input')[0].value = ''; }) document.addeventlistener("click", (e) => { if (e.target.classname != "country-box" && e.target.classname != "country-value" && e.target.classname != "icon" && e.target.classname != "n1") { console.log(e.target); $('.country-dropdown').slideup(); $('.country-box').find('.icon').removeclass('xz'); } if (e.target.classname != "province-box" && e.target.classname != "province-value" && e.target.classname != "icon" && e.target.classname != "n1") { $('.province-dropdown').slideup(); $('.province-box').find('.icon').removeclass('xz'); } if (e.target.classname != "city-box" && e.target.classname != "city-value" && e.target.classname != "icon" && e.target.classname != "n1") { $('.city-dropdown').slideup(); $('.city-box').find('.icon').removeclass('xz'); } }); })