-1
我添加了一个jQuery标签到一个运行良好的网页除了事实之外,没有选项可以关闭一个标签打开后。一个标签始终保持打开。这可能是一个简单的任务,但我对jQuery/JavaScript很陌生。任何帮助将非常感激。非常感谢!这里谈到的代码:jQuery关闭标签点击后,它已被打开
$(document).ready(function(){
var animTime = 300,
clickPolice = false;
$(document).on('touchstart click', '.acc-btn', function(){
if(!clickPolice){
clickPolice = true;
var currIndex = $(this).index('.acc-btn'),
targetHeight = $('.acc-content-inner').eq(currIndex).outerHeight();
$('.acc-btn h1').removeClass('selected');
$(this).find('h1').addClass('selected');
$('.acc-content').stop().animate({ height: 0 }, animTime);
$('.acc-content').eq(currIndex).stop().animate({ height: targetHeight }, animTime);
setTimeout(function(){ clickPolice = false; }, animTime);
}
});
});
您使用任何插件?如果不分享你的HTML也 – 2015-03-03 08:44:47