1
I have a screen with several Ivs that are draggable.
However, I need that when the user clicks on them, it creates an edge around it and adds some options (delete, for example).
But I want that when he clicks off this element, that that edge goes out and also the options disappear.
I’m trying it this way, but instead of taking what was clicked, he takes the Document:
$(document).click(function() {
var objeto = $(this);
if( objeto.prop('class') == "adesivo" || objeto.prop('class') == "quadro")
{
selecionaElemento(objeto);
}
else
{
deselecionaElementos();
}});
The function selecionaElemento(objeto)
does the following:
function selecionaElemento(objeto){
objeto.css("border", "1px solid #F00");
}
And the de-ElectionElements() does the following:
function deselecionaElementos(){
$('.adesivo').css("border", "none");
$('.quadro').css("border", "none");
}
What I’m doing wrong that instead of taking the element it takes the Document?
Very good. I’ll add it here in the code. But what if it clicks off and it’s not a dív? just put a function in Document.ready to deselect general?
– WitnessTruth
I had forgotten that Monday, I just put in the answer.
– AnthraxisBR
OK. I’ll put it here and, working, put it as an answer. Thank you.
– WitnessTruth