1
I am using iconfonts in a drop-down menu, where the link is as follows:
<li class="abre-dropdown"><a href="javascript:void(0)"><label style="float:left;" class="icon-location"></label>Nossa casa<label class="icon-down-dir"></label></a></li>
It is possible to make the label change its class when the menu is active (toggle effect) icon-down-dir
for any other, such as icon-up-dir
?
jquery script to open/close the menu:
var $j = jQuery.noConflict();
$j(".abre-dropdown").click(function(){
$j(this).children("ul").slideToggle();
})
$j("ul").click(function(p){
p.stopPropagation();
})
Thanks for the answer. It turns out I was a bit confused, mainly by Return and if/Else.. How could I adapt to the label? I’m sorry for the ignorance!
– Cobra
Don’t apologize, no one is born knowing. ;) Update, see if it solves your problem,
– RBoschini
I made a Fiddler to help you. https://jsfiddle.net/rboschini/torbne0v/
– RBoschini
I did a test and it didn’t work. When I click is adding a label above the link. I will pass the full link, because I believe that the click indication is missing information, maybe it is not just . open-drop-down.. <li class="open-dropdown"><a href="javascript:void(0)"><label style="float:left;" class="icon-Location"></label>Our home<label class="icon-down-dir"></label></a>
– Cobra
I don’t know yet I’m still wrong. I already tried $(". open-dropdown a label.icon-down-dir"). click(Function(){} but neither will it..
– Cobra
Then create an example similar to yours in jsFiddler and pass me the url
– RBoschini
Let’s go continue this discussion in chat.
– Cobra
https://jsfiddle.net/7p7v2co5/ The style bugged, but that’s the idea.. change the <label class="icon-down-dir to icon-up-dir when clicked, and when clicked again go back to dir down
– Cobra