Fix toolbar list header taking a while to get opened

This commit is contained in:
Hadi Nategh 2021-09-08 12:07:47 +02:00
parent 3fc0823f38
commit 5dbba31285

View File

@ -479,15 +479,19 @@ export class et2_toolbar extends et2_DOMWidget implements et2_IInput
heightStyle:"fill", heightStyle:"fill",
collapsible: true, collapsible: true,
active:'none', active:'none',
animate: 10,
activate: function (event, ui) { activate: function (event, ui) {
var menubox = event.target; var menubox = jQuery(event.target);
if (ui.oldHeader.length == 0) if (ui.oldHeader.length == 0)
{ {
jQuery('html').on('click.outsideOfMenu', function (event){ jQuery('html').on('click.outsideOfMenu', function (event){
jQuery(menubox).accordion( "option", "active", 2); if (menubox.accordion('instance'))
{
menubox.accordion( "option", "active", 2);
}
jQuery(this).unbind(event); jQuery(this).unbind(event);
// Remove the focus class, user clicked elsewhere // Remove the focus class, user clicked elsewhere
jQuery(menubox).children().removeClass('ui-state-focus'); menubox.children().removeClass('ui-state-focus');
}); });
} }
}, },