DojoToolkit AccordionContainer

2019-08-24 19:44发布

问题:

How easy is it to make AccordionContainer provided with Dojotoolkit to slide up and down On MouseHover of Title rather than onMouseClick of the title pane.

回答1:

This is fairly straightforward, but involves connecting to the semi-private _buttonWidget property for each child pane, so I can't guarantee that future versions of the toolkit won't break it. That said, I've tested in with the version of Dojo 1.3 on AOL's CDN.

Basically, after you've called startup() on your AccordionContainer, you just iterate through its children and connect each child's _buttonWidget to an anonymous onMouseOver event handler:

aContainer.getChildren().forEach(function(child){ 
    dojo.connect(child._buttonWidget, "onMouseOver", function(){
        aContainer.selectChild(child);
    });
});

Full example is here



标签: dojo