EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: MSAG on April 04, 2023, 06:22:54 AM



Title: sub menu not fire onShow
Post by: MSAG on April 04, 2023, 06:22:54 AM
Hi
i want to relocate sub menu because it get out of screen border
onShow not work on sub menu


<div id="mm" class="easyui-menu" data-options="onShow:menuHandler1" style="width:120px;">
    <div>New</div>
    <div>
        <span>Open</span>
        <div data-options="onShow:menuHandler2" style="width:150px;">
            <div><b>Word</b></div>
            <div>Excel</div>
            <div>PowerPoint</div>
        </div>
    </div>
    <div data-options="iconCls:'icon-save'">Save</div>
    <div class="menu-sep"></div>
    <div>Exit</div>
</div>

<script type="text/javascript">
   function menuHandler1(){
      alert('1');
   }
   function menuHandler2(){
      alert('2');
   }
</script>


Title: Re: sub menu not fire onShow
Post by: jarry on April 05, 2023, 07:38:38 PM
The 'onShow' event fires only when the top menu displays. If you want to change the default position of the menu, please try to set the 'position' function for the menu.
Code:
$('#mm').menu({
position: function(target,left,top){
return {left:left,top:top}
}
})