Titulos al estilo Alejandro con jQuery
Este mini-plugin va en honor a Alejandro Adriasola amo y señor de las páginas web y el diseño.
Lo que hace es bien sencillo, toma un texto y lo junta envolviendolo con spans alternando las clases para obtener un lindo resultado si se usa con un css adecuado.
* Licensed under CBSDLLIAT (http://twitter.com/joaquin_nunez/status/1852053223636992)
*
* Version : 0.1
*
* Requires: jQuery 1.4+
*/
(function($)
{
jQuery.fn.AlejandroTitle = function(options)
{
var defaults = {
firstClass: ‘green’,
secondClass: ‘gray’
};
var opts = $.extend(defaults, options);
this.each(function(){
var title = jQuery(this).html();
var words = title.split(‘ ‘);
var newTitle = ”;
jQuery(words).each(function(index, word){
cssClass = index % 2 == 0 ? defaults.firstClass : defaults.secondClass;
newTitle += ‘<span class="’+cssClass+‘">’ + word + ‘</span>’;
});
jQuery(this).html(newTitle);
});
}
})(jQuery);


1:48 pm
May 20th, 2011
Y el resultado?
7:51 pm
January 12th, 2012
asd