VPenkov / okayNav

The world's okayest responsive navigation. This is (sort of) a legacy implementation. Please stay tuned to the 3.0 branch (https://github.com/VPenkov/okayNav/tree/v3.0)
4.02k stars 266 forks source link

Throttle / debounce nav recalc requests ? #7

Closed vorbe closed 8 years ago

vorbe commented 8 years ago

$(window).on('load.okayNav resize.okayNav', function(event) { _okayNav.recalcNav(); console.log('resized'); }); I logged this part here to see what was happening when the browser was resizing (and the nav was changing/ recalculating ) , it seems maybe little excessive and could be throttled or reduced a little?

I'm not 100% sure how badly this would affect real world performance (it seems pretty good at the moment) or if it would add unnecessary weight to the js.

Side note: I'm not a developer at all, more a curious designer..

VPenkov commented 8 years ago

I thought about this while developing the plugin but let's face it, how often do you resize your browser? Except when testing a plugin's performance, of course. I think throttling will have a negligible impact for any user.

With that being said, your point is still valid but just not an immediate concern.

VPenkov commented 8 years ago

After some testing, turns out I was wrong. On Chrome in Android, when you scroll down, the nav bar hides. While it's hiding, it fires the resize event.

This has been taken care of.

Now I need to make sure the kebab icon doesn't move to a new line.