Converting top menu into the select box when resizing browser's window
Hi all,
I have written a simple jQuery code that uses a plugin to convert menu into a simple select box when the menu can't fit into the container.
It works fine, but I would like to make it execute in "real time", when user manually resizes the browser's window. Now, if you want to see the effect, you must resize the window and then click Refresh.
Is it possible?
- jQuery(function () {
- var topMenuContainerWidth = jQuery("div.cell").has("ul.nav").innerWidth();
- var topMenuWidth = jQuery("ul.nav").innerWidth();
- if(topMenuWidth >= topMenuContainerWidth) {
- jQuery(".tinynav").css("display","block");
- jQuery("ul.nav").css("display","none");
- jQuery("ul.nav").tinyNav({
- active: 'current', // String: Set the "active" class
- });
- }
- });