Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equal sizes of menu item #57

Open
titusvk opened this issue Jun 20, 2015 · 0 comments
Open

equal sizes of menu item #57

titusvk opened this issue Jun 20, 2015 · 0 comments

Comments

@titusvk
Copy link

titusvk commented Jun 20, 2015

The menu should show the items in the width of the parent element. display Inline block does the magic.

    init: function()
    {
        var $options = this.options,
            $menu = this.$elem,
            $collapser = '<div class="menu-collapser">'+$options.collapserTitle
            +'<div class="collapse-button"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></div></div>',
            $menu_collapser;

// start

        $menu.find('>li').each(function(){

            var max_width = $(this).width();

            $(this).find('>ul>li').each(function(){
                $(this).parent().show(); // zeigen, um die Größe berechnen zu können
                var width = $(this).width();
                if (width > max_width) max_width = width;

                var max_width_2 = 0;

                $(this).find('>ul>li').each(function(){
                    $(this).parent().show(); // zeigen, um die Größe berechnen zu können
                    $(this).css('display','inline-block');
                    var width = $(this).width();
                    if (width > max_width_2) max_width_2 = width;
                });

                $(this).find('>ul').width(max_width_2);

                $(this).find('>ul>li').each(function(){
                    $(this).width(max_width_2).css('display','block');
                });

            });

            $(this).find('>ul').width(max_width);

            $(this).find('>ul>li').each(function(){
                $(this).width(max_width);
            });

        });

// end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant