3
How can I return mine div
to the starting position if it reaches a certain point on the left? I have the following current code:
$(document).ready(function() {
$("#botao").click(function() {
$(".maior").animate({left:"-=400px"},1000)
});
});
CSS:
.maior {
width: 1614px;
height: 433px;
float: right;
position: absolute;
font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
color: #FFF;
font-weight: bolder;
overflow: hidden;
left: 9px;
top: -4px;
}
Another possibility is to use another
animate
within the function of the former, for example: http://jsfiddle.net/w25Aj/3/– Marciano.Andrade
Well thought out @Marciano.Andrade this way gets even smoother the transition back.
– Kazzkiq
The problem is that this does not satisfy the need of the OP, since he wants the element to return to place when reaching a certain point.
– Marciano.Andrade
Or apparently not, I don’t get it now
– Marciano.Andrade
gave some error with the @Sergio code, with the other returns, but does not check the position.
– Harison