if statement - Boolean Jquery While/If -


sorry question bad in jquery.

i created menu on website openable click, , want while/if menu opened opacity 0.

i created variable

var isopened = false; //bool  

and in function:

$('#sidebar-menu, #overlay').click(function() {     $('.portfolio-full').removeclass('portfolio-open');     $('#top').removeclass('portfolio-open');     $('#sidebar-button').toggleclass('open');     $('#sidebar-menu').toggleclass('open');     $('body').toggleclass('sidebar-open');     isopened = true;     return false; }); 

and after code put:

if (isopened = true) {     $('#top').stop().animate({'opacity':'0'},400); } 

or

while (isopened = true) {     $('#top').stop().animate({'opacity':'0'},400); } 

but not working, why?

you should use '===' instead of '=', '=' assign operator.

then put $('#top').stop().animate({'opacity':'0'},400); in .click() function body.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -