Collapse all button not working
I have an image swap script that I am using. I have 2 buttons, Expand All and Collapse All. I was able to get the Expand All button linked so now when I click it, it updates the + and - signs to change when clicked. I can't figure out how to get the collapse all button linked in though. Obviously, when i Click expand All, it expands all of the list and changes the + sign to a minus and if I click expand all again, it changes the - sign to a +. I want to do the opposite when the collapse all button is clicked. So when i click expand it will open everything and change to - and when i click on collapse all it will close everything and change the - to a +. Here is the code that I am using without the collapse all button linked:
- $(".show").click( function(){
- $(".screentitle").show("normal");
- var $img = $(".img-swap");
- if ($img.attr('src').indexOf("plus.png") > -1) {
- $img.attr('src', $img.attr('src').replace('plus', 'minus'));
-
- }else{
-
- $(".screentitle").hide("normal");
- $img.attr('src', $img.attr('src').replace('minus', 'plus'));
- }
- });
The class for the collapse all is called ".hide"
Any help tying this in is much appreciated.