Reputation: 32
I want to change the toggle arrow image based on the particular toggle panel
based on the click i want to toggle between the right and down arrows
CSS:-
.icon
{
height:14px;
width:14px;
float:left;
position:relative;
margin-right:10px;
background:url("http://glyphicons.com/wp- content/themes/glyphicons/images/glyphicons_halflings.png") no-repeat;
}
.icon-rightarrow
{
background-position:-456px -72px;
}
.icon-downarrow
{
background-position:-313px -119px;
}
Upvotes: 0
Views: 6087
Reputation: 48445
You can do this with the AddClass and RemoveClass functions.
The following will change a right-arrow to a down-arrow:
$("#MyElementId").removeClass("icon-rightarrow");
$("#MyElementId").addClass("icon-downarrow");
Upvotes: 2
Reputation: 74738
j(this).closest('li').find('.icon')
.toggleClass('icon-rightarrow, icon-downarrow');
use .toggleClass()
to toggle between the classes
to right
and down
arrow icon.
Upvotes: 1