Skip to content

Instantly share code, notes, and snippets.

@juque
Created August 3, 2010 08:48
Show Gist options
  • Select an option

  • Save juque/506067 to your computer and use it in GitHub Desktop.

Select an option

Save juque/506067 to your computer and use it in GitHub Desktop.
jQuery: Menu Pipe
/**
* menú pipe
* Muy simple plugin jQuery que
* deja un separador entre los ítemes del
* menú de navegación:
*
* Ejemplo:
*
* $(function(){
* $('#nav').menuPipe();
* });
*
* Resultado:
*
* item | item | item | item
*
* @autor: Juan Pablo Aqueveque - juque.cl
*
*/
(function($) {
$.fn.menuPipe= function(settings) {
var config = {
separador : '|',
envolturaA : '<span>', //abre
envolturaC : '</span>' //cierra
};
if (settings) $.extend(config, settings);
this.each(function() {
elemento = $(this).find('li').not(':last');
elemento.append(config.envolturaA+config.separador+config.envolturaC);
});
return this;
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment