$(function(){ function stopPropagation(e){ e=window.event || e; if(document.all){ e.cancelBubble=true; }else{ e.stopPropagation() } } $('.header_107 .language').click(function(event){ stopPropagation(event); $(this).toggleClass('cur'); $('.header_107 .currency').removeClass('cur'); }); $('.header_107 .currency').click(function(event){ stopPropagation(event); $(this).toggleClass('cur'); $('.header_107 .language').removeClass('cur'); }); var downhtml = ""; $('.header_107 .swiper-slide').each(function(){ if($(this).find('.navchildbox').length == 0) $(this).addClass('no'); else $(this).find('.navfirst').append(downhtml); }); if($(window).width() >= 768){ var searchwidth = $('.header_107 .container').width()-$('.header_107 .logo').width() - 48; $('.header_107 .serchinput').css({'width':searchwidth+'px'}); $('.header_107 .swiper-slide').each(function(){ var html = $(this).find('.navchildbox'); $(this).attr('data-id',$(this).index()+1); $(this).find('.navchildbox').attr('data-id',$(this).index()+1); $('.header_107 .headmain .container').append(html); }); $('.header_107 .navchildbox').each(function(){ var maxheight = $(this)[0].scrollHeight + 30; $(this).css('max-height',maxheight); }); $('.header_107 .search').click(function(event){ $(this).addClass('cur'); var left = searchwidth - $('.header_107 .search').width(); $('.header_107 .serchinput').animate({'left':'-'+left+'px','opacity':'1'},500); }); $('.header_107 .icon-clear').click(function(event){ let _this = $(this); stopPropagation(event); $('.header_107 .serchinput').animate({'left':'20px','opacity':'0'},500); setTimeout(function(){ _this.closest('.search').removeClass('cur'); },400) }); if(!$('body').hasClass('designer-body')){ setTimeout(function(){ new _swiper(".header_107",{ set:{ slidesPerView:'auto', spaceBetween: 0, freeMode: true } }); },300); }else{ $('.header_107 .swiper-container').addClass('swiper-no-swiping'); setTimeout(function(){ new _swiper(".header_107",{ set:{ slidesPerView:"auto", spaceBetween: 0, freeMode: true, nextButton: ".swiper-button-next", prevButton: ".swiper-button-prev" } }); },300); } $('.header_107 .swiper-slide').click(function(){ event.stopPropagation(); var id = $(this).attr('data-id'); var heightcur = $('.header_107 .navchildbox[data-id='+id+']').hasClass('showcur'); var nav = $(this).hasClass('no'); if(nav != true){ if(heightcur == true){ $('.header_107 .navchildbox[data-id='+id+']').removeClass('showcur'); }else{ $('.header_107 .navchildbox[data-id='+id+']').addClass('showcur').siblings().removeClass('showcur'); } } $(this).find('.navfirst').toggleClass('active'); $(this).siblings().find('.navfirst').removeClass('active'); }); }else{ $('.header_107 .childhead,.header_107 .languagebox a,.header_107 .search .serchinput').click(function(event){ stopPropagation(event); }); $('.header_107 .togglebtn').click(function(){ $('.header_107 .box_right').toggleClass('cur'); $(this).toggleClass('cur'); }); $('.header_107 .navfirst').click(function(){ var nav = $(this).hasClass('no'); if(nav != true) $(this).toggleClass('active').siblings('.navchildbox').toggleClass('showcur'); $(this).parent('.swiper-slide').siblings().find('.navchildbox').removeClass('showcur'); $(this).parent('.swiper-slide').siblings().find('.navfirst').removeClass('active'); }); $('.header_107 .more').click(function(){ $(this).siblings('.head_r_one').toggleClass('cur'); }); } $(document).click(function(event){ $('.header_107 .headmain').removeClass('cur'); $('.header_107 .navchildbox').removeClass('cur'); $('.header_107 .language').removeClass('cur'); $('.header_107 .currency').removeClass('cur'); }); if (get_siteInfo(['member','status']) == 'OPEN') { $.ajax({ url: "/member/islogin", type: 'GET', dataType: "json", success: function(json){ if(json.status == 1){ $("#login-static").html(''+ json.data.username +''); } } }); } function changeCurrency(id){ if ($("body").hasClass("designer-body")) {return} if (!id) { return; } $.ajax({ url: "/shopping/changerate", type: 'POST', dataType: 'json', data: {id: id}, success:function(res){ // $(".icon_txt").find("#symbol").text(res.data.symbol); // $(".icon_txt").find("#code").text(res.data.code); window.location.reload(); } }); } relate_search($('.tem105-header input[name="searchname"]')); });