Search code examples
sharepointsharepoint-2010sharepoint-2013

SharePoint WebPart Context Menu is going inside div (please see picture)


I have created MasterPage and page layout. Then I created a page using page layout. Then by editing the page, I added content editor web part but there was one issue that web part context menu was going inside div. Kindly see attached image.

your response would be highly appreacited.

Thanksenter image description here


Solution

  • it may helped somebody that I managed it programmatically using javascript.

    when icon will be clicked then javascript function will be fired which will check the height of context menu and if the height is greater than the height of the web part then it will increase the height of the zone height. please see code below.

    var menulistheight;
    var zoneid;
    jQuery('.js-webpart-menuCell').click(function (e) {
        if (!menulistheight) {
            var dd = jQuery('.ms-core-menu-list');
            dd = dd.height();
            menulistheight = dd;
        }
        var zone = $(e.target).closest("#MSOZone")[0];
        var id = jQuery(zone).attr("zoneid");
    
        var zHeight = jQuery(zone).height();
    
        if (zHeight < menulistheight) {
            jQuery(zone).css("height", zHeight + menulistheight - 100 + "px");
        }
    });