為啥函數(shù)后面要加retrun false
?$(function () {
? ? ? ? //navlist
? ? ? ? $('#navList').on('click', '.nav-btn', function (event) {
? ? ? ? ? ? if ($(this).hasClass('btn-active')) {
? ? ? ? ? ? ? ? $('#expandZone #closeBtn').click();
? ? ? ? ? ? ? ? return false;
? ? ? ? ? ? }
? ? ? ? ? ? var curIndex = $(this).index() , mlValue = '-' + curIndex * 100 + '%';
? ? ? ? ? ? if ($('#expandZone').hasClass('active')) {
? ? ? ? ? ? ? ? $('#expandZone .expdiv').animate({ marginLeft: mlValue });
? ? ? ? ? ? }
? ? ? ? ? ? else {
? ? ? ? ? ? ? ? $('#expandZone .expdiv').css({ marginLeft: mlValue });
? ? ? ? ? ? ? ? $('#expandZone').animate({ height: '130px' }).addClass('active');
? ? ? ? ? ? }
? ? ? ? ? ? $(this).addClass('btn-active').siblings().removeClass('btn-active');
? ? ? ? ? ? return false;
? ? ? ? });
? ? ? ? $('#expandZone #closeBtn').on('click', function () {
? ? ? ? ? ? $('#expandZone').animate({ height: '0px' }, function () {
? ? ? ? ? ? ? ? $(this).removeClass('active');
? ? ? ? ? ? ? ? $('#navList .btn-active').removeClass('btn-active');
? ? ? ? ? ? });
? ? ? ? ? ? return false;
? ? ? ? });
? ? });
2016-10-26
阻止默認(rèn)事件結(jié)束這個(gè)事件