jquery - How do i make the green box only slide 90% -
i green box (#box3
) go 90% right. box directly inside body element.
<div id='box1'> <div id='box2'> </div> <div id='box3'> </div> </div>
$( "#box1" ).click(function() { $( "#box3" ).toggle("slide",
#box1 { background-color: white; height: 600px; width: 600px; margin: auto; } #box2 { background-color: red; height: 600px; width: 300px; float: left; } #box3 { background-color: green; height: 600px; width: 300px; float: left; }
you can use jquery animation instead:
// define left position, used defined 80% <div id='box3' style="left:80%"> <script> $( "#box1" ).click(function() { $('#box3').animate({left:'90%'},"fast","swing"); } ); </script> // box 3 #box3 { position:relative; background-color: green; height: 600px; width: 300px; float: left; }
Comments
Post a Comment