Hi everyone!
I have a menu and i need it to open and close on a click + the on a left side of menu (plus and minus) must change as well.
We can make a close/open menu with a method toggle(), but have can i make to change a picture with every click?
Here's my code(i was trying to make it with "var i" but it was useless):
- $(document).ready(function(){
-
- var i = 0;
-
- $(".go").click(function(){
-
- if(i == 1) {
- $(this).next().children().children().children().children().hide();
- $(this).css('background-image','url(<?php echo $siteurl?>/css/img/plus.png)');
- $(this).css('background-repeat','no-repeat');
- }
-
- if(i == 0) {
- $(this).next().children().children().children().children().show();
- $(this).css('background-image','url(<?php echo $siteurl?>/css/img/minus.png)');
- $(this).css('background-repeat','no-repeat');
- }
- });
-
- });