adgsm / multi-level-push-menu

MultiLevelPushMenu jQuery Plugin implementation
http://multi-level-push-menu.dzunic.net
804 stars 212 forks source link

Automatic height #167

Open abombelli opened 7 years ago

abombelli commented 7 years ago

Hi

Is there a way to set an automatic height of the menu? Let's say a sub-menu has more items then the parent, then the container adapts to his height.

Thanks!

adgsm commented 7 years ago

Hi,

Overall menu height, if not set in options to some fixed value, will be set equal to the tallest menu height.

For example try commenting out menuHeight in custom size demo shown at http://multi-level-push-menu.make.rs/demo/customsize/customsize.html. Once you've done that height of the menu will be equal to height of the tallest (sub)menu (e.g. Magazines).

Regards

wal88 commented 6 years ago

Hi @adgsm, Is there anyway to set height to the current submenu? or at least find out height of current (sub)menu? I don't want to limit the height or introduce scrollbar, I just want the page to adapt to current longest content.

Thanks

adgsm commented 6 years ago
$("[data-level=1]").height();
wal88 commented 6 years ago

thanks for getting back. I tried this but it seems to return the same height whatever submenu I click into?

adgsm commented 6 years ago

You have to choose right selector ($("[data-level=1]")) for targeted submenu. $("[data-level=1]") was just an example for 1st sub menu after root.

adgsm commented 6 years ago

For example

$( '#menu' ).multilevelpushmenu({
    onItemClick: function() {
            // Second argument is menu level object containing clicked item (<div> element)
            $menuLevelHolder = arguments[1];
            $menuLevelHolder.height();
    }
});

will return height of the (sub)menu containing clicked item.

wal88 commented 6 years ago

both using $menuLevelHolder = arguments[1]; $menuLevelHolder.height(); in onItemClick and onGroupClick, gives the same number as any data-level, for some reason the height is all set to max. The proper height of each submenu seems to be the ul tag inside each div.levelHolderClass I'm confused.. sorry

adgsm commented 6 years ago

Each menu is contained within div element. Div element contains ul which then contains li elements... using same jquery method you can mesaure height of any of these elements, or maybe top offset if you like...

pon, 14. maj 2018. 02:13 Waleed Al-saady notifications@github.com je napisao/la:

both using $menuLevelHolder = arguments[1]; $menuLevelHolder.height(); in onItemClick and onGroupClick, gives the same number as any data-level, for some reason the height is all set to max. The proper height of each submenu seems to be the ul tag inside each div.levelHolderClass I'm confused.. sorry

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/adgsm/multi-level-push-menu/issues/167#issuecomment-388666383, or mute the thread https://github.com/notifications/unsubscribe-auth/AFhKYyhwCeqhxcTqd69nE0wpJOvFS3Keks5tyMw2gaJpZM4LtOQL .