0
What about you guys, huh? Guys, I’m having a question, I have a posting system similar to facebook, and as you know, there is in the post for the user to open the settings to delete and etc, that by clicking it displays the div with the options, right, so far so good, I made the system to be able to apply the class 'block' in this div by clicking on the icon of the options... The problem is, when the user clicks on the icon, it displays, but it only disappears if they press the icon again, and I wanted it to disappear by clicking anywhere else, and like, I pressed displayed one, if I leave it open and press the setting for another post, is visible both, and I wanted it to disappear when I press anywhere else and when I press one if there is already any visible, it hides the visible and shows what the user requested, I tried to do this with Blur(), but for some reason it did not work, follows below the code. js, remembering that I am using Jquery:::
//Código Js, função para exibir a div .configsOp e também esconder...
$('.configsPost .icon').on('click', function(){
$(this).parent().find('.configsOp').fadeToggle(200).toggleClass('block');
});
//Código que tentei usar para remover a Class Block da div.configsOp
$('.configsOp').blur(function(){
$(this).fadeToggle(200).removeClass('block');
});
Whoever knows help me please.
That didn’t work for me no.
– Breno Castro
And I don’t want to call function in HTML code no, but call div directly in code.
– Breno Castro
run the snippet I sent in the stack overflow itself (run button) and check if it has the desired behavior, with respect to not calling in html code I can modify my example without problems
– Gustavo Freire
modified the example for the event to be executed via javascript ( and not directly inserted into the html code)
– Gustavo Freire