Jump to content
Portocala

Ce nu merge bine (display block si none)?

Recommended Posts

Salut PCT, am acest cod...

$(function() {
var myElement = document.querySelector(".efUserMenu");

if( $('.efUserMenu').hasClass('displayNone')) { 
$(".openUserMenu").click(function(){
    $('.efUserMenu').removeClass('displayNone')
    $('.efUserMenu').addClass('displayBlock')
    myElement.style.display = "block";
});
}
if( $('.efUserMenu').hasClass('displayBlock')) { 
$(".openUserMenu").click(function(){
    $('.efUserMenu').removeClass('displayBlock')
    $('.efUserMenu').addClass('displayNone')
    myElement.style.display = "none";
});
}

});

Practic eu vreau un cod care daca div-ul are class-ul "displayBlock" sa execute niste comenzi in momentul in care dau click pe div-ul .operUserMenu si in cazul in care are "displayNone"... Ati prins voi ideea. Prima daca div-ul meu ".efUserMenu" are declarata class-ul ".displayBlock", ok, cand dau click pe ".openUserMenu" dispare, dar din dau din nou pe ".openUserMenu" nu apare la loc. 

Sugestii?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×