Issue with setInterval and trigger. javascript jquery -


what trying create nav has drop down menu button, when viewport width less 600px. code using works, drop down menu stay down until screen size above 600px. right work, except if click drop down menu , change viewport size resets before click. ideas?

my code

$(function () {         resizeok = true,         timer = setinterval(function () {             resizeok = true;         }, 100);         $(window).on('resize', function () {             if (resizeok) {                 resizeok = false;                 if ($("#header").width() <= 600) {                     $("#nav").hide();                     $(".menu").show();                     $(".menu2").hide();                     $(".menu").click(function() {                         $("#nav").show();                         $(".menu").hide();                         $(".menu2").show();                         })                     $(".menu2").click(function() {                         $("#nav").hide();                         $(".menu2").hide();                         $(".menu").show();                         })                 }                 else if ($("#header").width() >= 600) {                     $("#nav").show();                     $(".menu").hide();                     $(".menu2").hide();                 }             }         }).trigger('resize')     }); 


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -