I use a bit of code suggested by a member on stackoverflow and adapted by me to wrap all 3 list items as part of a mega menu. The code:
var lis = $("ul > li");
for(var i = 0; i < ls.length; i+=3) {
lis.slice(i, i+3).wrapAll("<div class='new'></div>");
}
Unfortunately, this will lead to capturing the child li from the next parent menu to fill the quota of 3 li in the div. This, of course, massively ruin my menu. For an example, please visit here.
Does anyone have a suggestion how I can fix this?
source
share