$(function () { $('.sc-form').find('form').submit(function () { var val = $(this).find('input').val(); if (!val) { alert('请输入关键字'); return false } }); $('.menu-btn').on('click', function () { $('.header').find('.nav').toggle(); }); if ($(window).width() > 991) { $('.dropdown').hover(function () { $(this).addclass('open'); }, function () { $(this).removeclass('open'); }); } else { $('.dropdown').find('.arr').on('click', function () { $(this).parent().toggleclass('open'); }); } $('.lanmu').find('.arr').on('click', function () { $(this).parent().toggleclass('open'); }); // 右侧滑动返回顶部 $('.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); }); }); $(document).ready(function() { var index = 0; $("#nav_bottom .nav_bottom_list").click(function() { var index = $(this).index(); console.log(index) $("#nav_bottom .nav_bottom_list").removeclass("nav_bottom_list_active"); $("#nav_bottom .nav_bottom_list").eq(index).addclass("nav_bottom_list_active"); $("#nav_bottom_tab .bottom_tab_box").removeclass("bottom_tab_box_active"); $("#nav_bottom_tab .bottom_tab_box").eq(index).addclass("bottom_tab_box_active"); }); });