Hej.. Jag håller på att lägga in ett mootools script och skulle vilja förenkla denna kod om det går. Känns lite dumt att skriva denna repeterande kodsnutt hela tiden. Skickar med de två första händelserna (portfolioasset 1 och 2) i den slutgiltiga så har jag ca 20 st liknande händelser. Hoppas ni förstår hur jag menar med att förenkla den.
$('portfolioAsset1').addEvents({
'mouseenter': function(){
// Always sets the duration of the tween to 1000 ms and a bouncing transition
// And then tweens the height of the element
this.set('tween', {
duration: 1000,
//transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out'
}).tween('height', '300px');
},
'mouseleave': function(){
// Resets the tween and changes the element back to its original size
this.set('tween', {}).tween('height', '149px');
}
});
$('portfolioAsset2').addEvents({
'mouseenter': function(){
// Always sets the duration of the tween to 1000 ms and a bouncing transition
// And then tweens the height of the element
this.set('tween', {
duration: 1000,
//transition: Fx.Transitions.Bounce.easeOut // This could have been also 'bounce:out'
}).tween('height', '300px');
},
'mouseleave': function(){
// Resets the tween and changes the element back to its original size
this.set('tween', {}).tween('height', '149px');
}
});