I'm trying to make a JQuery accordion which will change it's style to .active{} when clicked, so the open accordion pane's header looks different from all the other panes of the accordion. Here's what I have so far (it makes the accordion work, but the colors don't):
<script 开发者_运维知识库type="text/javascript">
$(function () {
nyah = $("#accordion").accordion({
event: "mouseover",
animate: "slow",
active: 2,
});
$('#div0').bind('accordionchange', function(event, ui) {
addMessage("change");
ui.oldHeader.removeclass('active');
ui.newHeader.addclass('active');});
nyah.accordion("activate", 1);
});
setTimeout(function () { nyah.accordion("activate", 0) }, 1000);
</script>
Consider using jQueryui which already does this for you. You can then just re-style the active item using CSS. See http://jqueryui.com/demos/accordion/
精彩评论