Jump to content

Recommended Posts

Posted

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?

  • gaby changed the title to Ce nu merge bine (display block si none)?

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.