Menu icon Foundation
Top Bar Menu Icon : Auto triggering click event when viewport is mobile / tablet size

Hi there,

I was wondering if there was a way of simulating or triggering the click event of the Top-Bar Menu-Icon when the viewport of a page is of mobile / tablet size?

I've been investigating ways of doing this but it seems like I've only managed to go around in circles.

Can anyone help?

top barmenu iconAuto TriggerClick Events

Hi there,

I was wondering if there was a way of simulating or triggering the click event of the Top-Bar Menu-Icon when the viewport of a page is of mobile / tablet size?

I've been investigating ways of doing this but it seems like I've only managed to go around in circles.

Can anyone help?

This post has been closed. No new replies can be added.

Rafi Benkual almost 4 years ago

I'm assuming you changed the breakpoint to show the top-bar hamburger icon on a medium screen?

The .expanded class is added by jQuery to open the menu dropdown in the top-bar breakpoint. You can add the class with jQuery based on Windowsize as an option.

Something like this: http://codepen.io/rafibomb/pen/LVwgmY

Francis Chung almost 4 years ago

It works beautifully. Thanks Rafi again!