开发者

JQuery Accordion w/color changing headers?

开发者 https://www.devze.com 2023-03-03 03:24 出处:网络
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 w

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/

0

精彩评论

暂无评论...
验证码 换一张
取 消