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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...