Sorry, I've got it now: $('#sidebar_pos').toggle(function() { $('#content').find('#floated_one').css('float', 'left'); $('#content').find('#floated_two').css('float', 'right'); return false; }, function() { $('#content').find('#floated_one').css('float', 'right'); $('#content').find('#floated_two').css('float', 'left'); return false; });
On Jun 6, 4:21 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > 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