0
請檢查這裏的例子:http://jsfiddle.net/v5eV3/如何將style/css添加到簡單的jQuery手風琴?
我想知道如何添加樣式到該手風琴,尤其是當它活躍。
在懸停我管理,但問題是當它處於活動狀態。
jQuery代碼:
$(document).ready(function() {
var cur_stus;
//close all on default
$('#accordion dd').hide();
$('#accordion dt').attr('stus', '');
//open default data
$('#accordion dd:eq(0)').slideDown();
$('#accordion dt:eq(0)').attr('stus', 'active');
$('#accordion dt').click(function(){
cur_stus = $(this).attr('stus');
if(cur_stus != "active")
{
//reset everthing - content and attribute
$('#accordion dd').slideUp();
$('#accordion dt').attr('stus', '');
//then open the clicked data
$(this).next().slideDown();
$(this).attr('stus', 'active');
}
//Remove else part if do not want to close the current opened data
else
{
$(this).next().slideUp();
$(this).attr('stus', '');
}
return false;
});
});
活躍是不是一類。活躍就像懸停在CSS中: ':active' – Luceos 2013-03-17 20:08:29