1
I want that when I click on span
to ul
appear.
The correct thing is to use the Parent, nay?
$(".produtosMenu li span").click(function() {
$(".produtosSubmenu").parent().addClass("dpb");
});
.produtosMenu li {
box-sizing: border-box;
-webkit-transition: background-color .5s;
/* For Safari 3.1 to 6.0 */
transition: background-color .5s;
cursor: pointer;
}
.produtosMenu li span {
font: 700 13px/40px"open sans";
color: #fff;
padding-left: 15px;
background: #003a57;
width: 240px;
height: 40px;
display: inline-block;
text-transform: uppercase;
}
.produtosMenu li span:hover {
background: url("../imagens/detalhesFlecha.png") #006ba1 no-repeat 210px 14px;
}
.produtosSubmenu {
padding: 20px;
display: none;
}
.produtosSubmenu li {
font: 400 16px/16px"open sans";
color: #16232e;
}
.produtosSubmenu li:hover {
font: 600 16px/16px"open sans";
color: #006ba1;
}
.dpb {
display: block;
}
.dpn {
display: none;
}
<ul class="produtosMenu">
<li>
<span>Calotas</span>
<ul class="produtosSubmenu">
<li>Modelo 1</li>
</ul>
</li>
</ul>
You want every time span is clicked the list to open if it is closed and close if it is open?
– Erlon Charles
That’s right @Erloncharles, this attempt so far is just to open really, I thought to make a
else
to the contrary effect– Felipe Viero Goulart