Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Responsive navigation – hide & move items's to dropdown when space runs out Reply To: Responsive navigation – hide & move items's to dropdown when space runs out

#210451
grimski
Participant

As a javascript fix for the second codepen, I guess I could update the line:

var availablespace = $('.wrap').outerWidth(true) - morewidth;

to

var availablespace = $('.wrap').outerWidth(true) - morewidth - $('.title').outerWidth(true);

So the calculation deducts the width of the title from the available width. I guess this would work and I can’t see it doing much harm as the script is already calculating the width of every element – one more isn’t going to hurt?!

Though I get a CSS solution (if possible) makes it more flexible and reusable?