[jQuery] Change Css clasess
Hi there,
I've got 2 elements floating one with the css float:right and the
other one float:left, I would like to change both values at the same
time when a button is clicked.
The code that I have only works the first time and after that I'm
getting an error "too much recursion". I'm sure this is something
silly but I'm not a coder so would be great if anyone could help.
<code>
$(function() {
$("#button_pos").click( function() {
var pos = $("#sidebar").css("float");
if (pos = "left") {
$("#floated_one").css("float", "right")
$("#floated_two").css("float", "left")
}
else {
$("#floated_one").css("float", "left") }
$("#floated_two").css("float", "right")
} );
});
</code>
Many thanks