Pages Widget (Mega Menu) Layout


When creating columns of approximately even length with regard to the pages widget, the following constraints and contributing factors are outside the control of the algorithm doing the balancing: 

  • Number of columns
  • Order of menu item groups
  • Total number of items
  • Relative size (# of child items) of item groups
  • Font-size difference between 1st & 2nd level items
  • Text wrapping for items with longer menu text
  • If one column must be longer, it is should be the left-most
  • Performance – we need to generate results in a time frame acceptable to a modern web user

Within these constraints, we need to create a single algorithm that will be used for all possible configurations. We have yet to identify an algorithm that will result in ideally balanced columns for all configurations.

Our Algorithm

  1. Count the number of total items (at all levels)
  2. Divide that total by the number of columns
    • Note: The result is the target number of items in any given column.
  3. We fill the columns from right to left

At present, the best solution is to adjust the number of columns to that which yields the best result.

I'd Like to Request an Enhancement

0 out of 0 found this helpful


Article Feedback