MooTools - Transizione di rimbalzo
Mostra una transizione rimbalzante con eventi in, out e in-out. Facciamo un esempio in cui aggiungiamo amouse downevento a un elemento div insieme a eventi rimbalzanti. Dai un'occhiata al seguente codice.
Esempio
<!DOCTYPE html>
<html>
<head>
<style>
#bounce_in {
width: 100px;
height: 20px;
background-color: #F4D03F;
border: 2px solid #808B96;
}
#bounce_out {
width: 100px;
height: 20px;
background-color: #F4D03F;
border: 2px solid #808B96;
}
#bounce_in-out {
width: 100px;
height: 20px;
background-color: #F4D03F;
border: 2px solid #808B96;
}
</style>
<script type = "text/javascript" src = "MooTools-Core-1.6.0.js"></script>
<script type = "text/javascript" src = "MooTools-More-1.6.0.js"></script>
<script type = "text/javascript">
window.addEvent('domready', function() {
$('bounce_in').addEvent('mousedown', function(event) {
this.set('tween', {duration: 'long', transition: 'bounce:in'});
this.tween('width', [80, 400]);
});
$('bounce_out').addEvent('mousedown', function(event) {
this.set('tween', {duration: 'long', transition: 'bounce:out'});
this.tween('width', [80, 400]);
});
$('bounce_in-out').addEvent('mousedown', function(event) {
this.set('tween', {duration: 'long', transition: 'bounce:in-out'});
this.tween('width', [80, 400]);
});
});
</script>
</head>
<body>
<div id = "bounce_in"> Bounce : in</div><br/>
<div id = "bounce_out"> Bounce : out</div><br/>
<div id = "bounce_in-out"> Bounce : in-out</div><br/>
</body>
</html>
Riceverai il seguente output: