/* * @Author: anchen * @Date: 2019-03-30 16:14:10 * @Last Modified by: anchen * @Last Modified time: 2019-04-01 17:49:36 */ $(document).ready(function() { // 鎵嬫満瀵艰埅 $('.menuBtn').append(''); $('.menuBtn').click(function(event) { $(this).toggleClass('open'); var _winw = $(window).width(); var _winh = $(window).height(); if ($(this).hasClass('open')) { $('body').addClass('open'); if (_winw <= 1183) { $('.eyou-nav').stop().slideDown(); } } else { $('body').removeClass('open'); if (_winw <= 1183) { $('.eyou-nav').stop().slideUp(); } } }); // 瀵艰埅 if ($(".eyou-nav li").find('.nav-sub').length) { // $(".nav li").find(".nav-sub").siblings("a").attr("href","javascript:;") }; function myNav() { var _winw = $(window).width(); if (_winw >= 1183) { $('.eyou-nav').show().addClass('nav-pc').removeClass('nav-m'); $('body,.menuBtn').removeClass('open'); $('.eyou-nav').attr('style', ''); $('.eyou-nav').find('.nav-sub').attr('style', ''); $('.eyou-nav').find('.v1').removeClass('on').attr('style', ''); } else { $('.eyou-nav').hide().addClass('nav-m').removeClass('nav-pc'); } } myNav(); $(window).resize(function(event) { myNav(); $('.menuBtn').removeClass('open'); }); $('.nav-pc li').bind('mouseenter', function() { if ($(window).width() <= 1183) return; $(this).find('.nav-sub').stop().slideDown("fast"); if ($(this).find('.nav-sub').length) { $(this).addClass('ok'); } }); $('.nav-pc li').bind('mouseleave', function() { if ($(window).width() <= 1183) return; $(this).removeClass('ok'); $(this).find('.nav-sub').stop().slideUp("fast"); }); $('body').on('click', '.nav-m .v1', function () { var sub = $(this).next('.nav-sub'); var li = $(this).parent('li'); if (sub.length) { li.siblings('li').find('.nav-sub').slideUp("fast"); li.siblings('li').find('.v1').removeClass('ok'); $(this).toggleClass('ok'); sub.stop().slideToggle("fast"); return false; }; }); // 婊氬姩瀵艰埅鎮诞 $(document).on('scroll', function() { var scrollH = $(this).scrollTop(); if (scrollH > $('.header').height()) { $('.eyou-header').addClass('fixed'); } else { $('.eyou-header').removeClass('fixed'); } }) // 閫夐」鍗 榧犳爣鐐瑰嚮 $(".TAB_CLICK1 li").hover(function() { /* Stuff to do when the mouse enters the element */ var tab = $(this).parent(".TAB_CLICK1"); var con = tab.attr("id"); var on = tab.find("li").index(this); $(this).addClass('on').siblings(tab.find("li")).removeClass('on'); $(con).eq(on).addClass('show').siblings(con).removeClass('show'); }); $('.TAB_CLICK1').each(function(index, el) { $(this).children('li').filter(':first').trigger('click'); }); // 鑷畾涔夊崟閫 $('[role=radio]').each(function() { var input = $(this).find('input[type="radio"]'), label = $(this).find('label'); input.each(function() { if ($(this).attr('checked')) { $(this).parents('label').addClass('checked'); $(this).prop("checked", true) } }) input.change(function() { label.removeClass('checked'); $(this).parents('label').addClass('checked'); input.removeAttr('checked'); $(this).prop("checked", true) }) }) // 閫夐」鍗 榧犳爣鐐瑰嚮 $(".TAB_CLICK1 li").click(function() { /* Stuff to do when the mouse enters the element */ var tab = $(this).parent(".TAB_CLICK1"); var con = tab.attr("id"); var on = tab.find("li").index(this); $(this).addClass('on').siblings(tab.find("li")).removeClass('on'); $(con).eq(on).addClass('show').siblings(con).removeClass('show'); }); $('.TAB_CLICK1').each(function(index, el) { $(this).children('li').filter(':first').trigger('click'); }); // 鑷畾涔夊崟閫 $('[role=radio]').each(function() { var input = $(this).find('input[type="radio"]'), label = $(this).find('label'); input.each(function() { if ($(this).attr('checked')) { $(this).parents('label').addClass('checked'); $(this).prop("checked", true) } }) input.change(function() { label.removeClass('checked'); $(this).parents('label').addClass('checked'); input.removeAttr('checked'); $(this).prop("checked", true) }) }) // 瀹㈡湇 $('.kf .kf-side').click(function(){ //$('.kf').animate({ right: '-208' }, "slow"); var rt = $('.kf').css("right"); //alert(rt); var num = parseInt(rt); //alert(num); if(num < 0){ $('.kf').animate({ right: '20px' }, "slow"); $('.kf .kf-side span.arrow').addClass('on'); }else{ $('.kf').animate({ right: '-208px' }, "slow"); $('.kf .kf-side span.arrow').removeClass('on'); } }); $('.kt-top span.close').click(function(){ $('.kf').animate({ right: '-208px' }, "slow"); }); //杩斿洖椤堕儴 $('.kf .backTop').click(function() { $("html,body").stop().animate({ scrollTop: '0' }, 500); }); // 鎵嬫満搴曢儴鑿滃崟杩斿洖椤堕儴 $('.eyou-link li:last').click(function() { $("html,body").stop().animate({ scrollTop: '0' }, 500); }); // IE鏄剧ずplaceholder鍊 (function($) { $.fn.placeholder = function(options) { var opts = $.extend({}, $.fn.placeholder.defaults, options); var isIE = document.all ? true : false; return this.each(function() { var _this = this, placeholderValue = _this.getAttribute("placeholder"); //缂撳瓨榛樿鐨刾laceholder鍊 if (isIE) { _this.setAttribute("value", placeholderValue); _this.onfocus = function() { $.trim(_this.value) == placeholderValue ? _this.value = "" : ''; }; _this.onblur = function() { $.trim(_this.value) == "" ? _this.value = placeholderValue : ''; }; } }); }; })(jQuery); $("input[type=text],textarea").placeholder(); //鍐呭杩囧皯鏃秄ooter鑷姩鍒板簳閮 function initFooter() { $('.main').css('min-height','auto'); var dbH = $(document.body).height(); var wH = $(window).height(); var mH = $('.main').outerHeight(); var ylH = $('.eyou-link').css('display')=='none'?0:$('.eyou-link').outerHeight(); if(dbH < wH){ mH += wH - dbH - ylH; $('.main').css("min-height", mH); } } initFooter(); $(window).resize(function () { initFooter(); }); //鎼滅储妗嗘彁浜ら獙璇 $('.so input').focus(function () { $(this).val(''); }); $('.so input').blur(function () { var inputL = $(this).val().length; if (inputL == 0) { $(this).val('璇疯緭鍏ュ叧閿瓧'); } }); var timer = null; $('.so form').submit(function () { var inpLength = $('.so input').val().length; var inpVal = $('.so input').val(); if (inpLength == 0) { $('.tips').show(); $('.so input').val('').focus(); return false; } else if (inpVal == "璇疯緭鍏ュ叧閿瓧") { // $('.tips').addClass('on'); $('.tips').show(); $('.so input').val('').focus(); return false; } }); $('body').click(function () { $('.tips').hide(); }); // 鐐瑰嚮娑堝け $(document).ready(function () { $('.inp').focus(function () { $(this).attr("value", ""); }); }); // 渚у鑸 $('.snv-index li .v1').click(function () { var count = $(this).next('.snv-index-sub1').length; var li = $(this).parent('li'); if (count) { $(this).next('.snv-index-sub1').stop().slideToggle(); li.siblings('li').find('.snv-index-sub1').stop().slideUp(); return false; } }); $('.snv-index-sub1 > dd').click(function (event) { /* Act on the event */ event.stopPropagation(); }); // 渚у鑸 $('.snv-index-sub1 > dd .v2').click(function () { var count = $(this).next('.snv-index-sub2').length; var dd = $(this).parent('dd'); if (count) { $(this).next('.snv-index-sub2').stop().slideToggle(); dd.siblings('dd').find('.snv-index-sub2').stop().slideUp(); return false; } }); $('.snv-index-sub2 > dd').click(function (event) { /* Act on the event */ event.stopPropagation(); }); $('.snv-index-sub1 > dd.ok').parent('.snv-index-sub1').css('display','block'); });