here is my code:
$("#close_btn").click(function(){
$("#overlay").hide();
$("#overlay_content").remove();
$(".position_1").removeClass("position_1").addClass("position_2");
$(".position_2").removeClass("position_2").addClass("position_3");
$(".position_3").removeClass("position_3").addClass("position_4");
$(".position_4").removeClass("position_4").addClass("position_5");
$(".position_5").removeClass("position_5").addClass("position_6");
$(".position_6").removeClass("position_6").addClass("position_7");
$(".position_7").removeClass("position_7").addClass("position_1");
});
Basically what I want to do here is whenever the #close_btn is clicked the 7 elements that lie behind it will move position. 1 will change to 2, 2 will change to 3 ... 7 will change to 1, etc. This code however results in all of the elements to end up in .position_1. Is this possible to do? I want every time the close button is clicked that each element shifts 1 space.
css:
.position_1 { top:-500px; left:-175px; }
.position_2 { top:-300px; left:175px; }
.position_3 { top:0px; left:175px; }
.position_4 { top:150px; left:-20px; }
.position_5 { top:130px; left:-330px; }
.position_6 { top:0px; left:-500px; }
.position_7 { top:-300px; left:-480px; }
Here's the demo: