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
November 2, 2015 at 9:24 am
#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?