Is it possible to use two different icons as a sprite image for when the show and hide functions are active on a div
element?
For instance, having a + icon displayed when showing the div
, and then switching to a - icon when hiding it.
The current code I have is: http://jsfiddle.net/BLkpG/
$(document).ready(function(){
$(".slidingDiv").hide();
$(".show_hide").show();
$('.show_hide').click(function(){
$(".slidingDiv").slideToggle();
});
});
I am looking to update the images dynamically to display a + or - icon based on the toggle action.
Any guidance on how to achieve this would be greatly appreciated. Thank you!