开发者

Toggle Toolbar in Firefox extension

I have a toolbarbutton and I want it to toggle a toolbox > toolbar when it is clicked. I thought there might be an internal function开发者_JAVA百科 similar to toggleSidebar(id) but I cannot find it.


Well there is no function, however there is a simple solution for anyone looking for it.

First on the toolbarbutton add the following attribute:

oncommand="extName.toggleToolbar(event);"

then in the javascript:

toggleToolbar: function(e) {
    var toolbar = document.getElementById('uniqueName-toolbar');

    if(toolbar.getAttribute('hidden')== 'true'){
        toolbar.setAttribute('hidden', false);
    }
    else{
        toolbar.setAttribute('hidden', true);
    }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜