Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7008991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:48:21+00:00 2026-05-27T21:48:21+00:00

I am using superfish to create a horizontal menu on my website. The menu

  • 0

I am using superfish to create a horizontal menu on my website.

The menu items will always vary, as the content is very dynamic. The menu items should not have a fixed width.

When the enough menu items are displayed to fill the entire width of the website, a last menu called ‘More Items’ will be shown.

How would I go about measuring the width of each menu item (li tag), so that i can limit the items shown?

The problem is that I can not depend on a certain font to achieve this. Font’s must be, whatever is available on the visitors machine.

Thanks for your input

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:48:22+00:00Added an answer on May 27, 2026 at 9:48 pm

    Here’s one way to do this…

    example jsfiddle

    $(function() {
        $('.sf-menu').superfish();
    
        var tempWidth = 0,
            // width of our layout minus width of our "More Items..." menu
            maxWidth = $('#container').outerWidth() - $('#more').outerWidth(); 
    
        // get any menu items that extend past our maxWidth
        var $moreItems = $('.sf-menu > li').not('#more').filter(function() {
            tempWidth += $(this).outerWidth();
            if (tempWidth >= maxWidth) return true;
            else return false;
        });
    
        // if we have items extending past, add those items to "More Items..."
        if ($moreItems.length > 0) {
            $('#more').show().find('ul').append($moreItems);
        } else {
            $('#more').hide();
        }
    });
    

    In that middle segment I’m totaling up the widths of each menu item and when a threshold is met (the maxWidth) I’m returning those menu items so that I can add them to the “More Items” menu (in the final step)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery, superfish to create a dynamic menu. But, I'm having trouble adding
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
I am using superfish menu and I am having a problem which I can't
I am using jquery superfish menu and I am using colorbox for images just
Im using jQuery with superfish vertical menu. My menu is positioned at the bottom
I am using a Superfish plugin to display menu pop-ups but the problem is
I reduced the font size of a superfish menu using this code .sf-menu a
I'm using jquery.ui.tabs to create a carousel. On the same page is a superfish
I'm using the Superfish jQuery menu system and have a requirement to show all
I am using the superfish menu from this example: http://users.tpg.com.au/j_birch/plugins/superfish/#examples (with Supersubs). It works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.