I've never written an if statement before.
I want the two slideframe divs to move when I click but only if the variable navi is not equal to zero, and then to set navi to 1 after the divs have moved:
$(document).ready(function(){
$("#one").click(function(){
if (navi !=0) {
$(".slideframe").animate({opacity: "0.1", left: "-=960"}, 1200)
$(".slideframe1").animate({ left: "-=960"}, 1200)
navi = 1
}
});
});
This just breaks the working jquery, but the best result I have got is for one div to slide but never two.
What am I doing wrong?
So thanks to Patrik this makes one of the divs move but not the first one! (i.e not .slideframe) .. but they both move if i dont put the if statement in...
<script>
var navi = "0";
</script>
<script>
$(document).ready(function(){
$("#one").click(function(){
if (navi !=0)
$(".slideframe").animate({opacity: "0.1", left: "-=960"}, 1200);
$(".slideframe1").animate({ left: "-=960"}, 1200);
navi = 1;
});
});
</script>