$(document).ready(function() { // 选项卡 鼠标点击 $(".TAB_CLICK li").click(function() { var tab = $(this).parent(".TAB_CLICK"); var con = tab.attr("id"); var on = tab.find("li").index(this); $(this).addClass('on').siblings(tab.find("li")).removeClass('on'); $(con).eq(on).show().siblings(con).hide(); }); $('.TAB_CLICK').each(function(index, el) { if ($(this).find('li.on').length) { $(this).find("li.on").trigger('click'); } else { $(this).find("li").filter(':first').trigger('click'); } }); // 弹窗 $('.myfancy').click(function(e) { e.stopPropagation(); var _win = $(this).attr('href'); $(_win).stop().fadeIn(); }); $('.pop-bg,.m-pop .close,.m-pop .confirm').click(function(e) { e.stopPropagation(); $(this).parents('.m-pop').stop().fadeOut(); }); $('[role=checkbox]').each(function() { var input = $(this).find('input[type="checkbox"]'); input.each(function() { if ($(this).attr('checked')) { $(this).parents('label').addClass('checked'); $(this).prop("checked", true); } }); input.change(function() { $(this).parents('label').toggleClass('checked'); }); }); // 动画初始化 if (!(/msie [6|7|8|9]/i.test(navigator.userAgent)) && window.WOW) { var wow = new WOW({ boxClass: 'wow', animateClass: 'animated', offset: 0, mobile: true, live: true }); wow.init(); }; var _winw = $(window).width(); // 手机导航 $('.menuBtn').append(''); $('.menuBtn').click(function(event) { $(this).toggleClass('open'); $('.h-r').stop().slideToggle(); $('body').toggleClass('noscr'); }); if (_winw > 1199) { var imgBgs = $('.imgBg') imgBgs.each(function(indx, el) { $(el).css({ 'background-image': 'url(' + $(el).find('img').attr('src') + ')' }) }); $('.nav li').hover(function() { $('.nav li').removeClass('ok'); var $this = $(this) $this.addClass('ok'); if ($this.find('.sub').length) { $this.find('.sub').stop().slideDown(); } }, function() { var $this = $(this) $this.removeClass('ok'); $this.find('.sub').stop().slideUp(); }); } else { $('.nav li').unbind('mouseenter mouseleave').removeClass('on') $('.nav .v1').click(function(e) { e.stopPropagation(); $(this).siblings('.sub').stop().slideToggle().parents('li').toggleClass('on').siblings('li').removeClass('on').find('.sub').stop().slideUp(); if ($(this).siblings('.sub').length) { $(this).attr('href', 'javascript:;') } }); $('.h-so .icon').click(function(e) { e.stopPropagation(); $(this).siblings('.form').stop().slideToggle(); }); $('.h-so .form').click(function(e) { e.stopPropagation(); }); $('body').click(function(e) { $('.h-so .form').stop().slideUp() }); } })