I <3 jQuery1:05 Sep 27th, 2009 | 1 note
Ok, I used to diss jQuery. I sooo take it back. I just replaced this (mootools):
var Banner = new Class({
initialize: function( objElem, objSettings, fnAfterInit )
{
// Copy the values into the rack object
this.objElem = objElem;
// if the settings object was not passed in, or is null, then use default settings
if( $chk( objSettings ))
{
this.objSettings = objSettings;
}
else
{
// Create the settings object
this.objSettings = new Object();
// The color to fade the background to
this.objSettings.strFadeTo = '#FFFFC2';
}
// If there was an "AfterInit" function passed, call it
if( fnAfterInit )
{
// Call the "AfterInit" function
fnAfterInit();
}
// Fade the bg
var objFadeEffect = new Fx.Morph( objElem, {duration: 2000, transition: Fx.Transitions.Sine.easeIn });
objFadeEffect.start({
'background-color': this.objSettings.strFadeTo
});
}
});
window.addEvent( 'domready', function()
{
// Auto load the nifty class
jsRack = new Asset.javascript( '/static/js/la/jimmy/Banner.class.js',
{
onload: function()
{
// Retrieve every nifty element on the page
$$( '.banner' ).each( function( objElem )
{
// For each one, create a nifty instance
tmpBanner = new Banner( objElem );
});
}
});
});
With this (jQuery):
$( ".banner" ).animate({ backgroundColor: "#FFFFC2" }, 3000 );
|
|