Categorias

Arquivos

jQuery Center plugin

Postado em Março 23rd, 2008 por Alexandre Magno

Plugins, Jquery

Este plugin centraliza qualquer elemento através do método CSS da margem negativa.

Como usá-lo

Sem nenhum argumento, o método do plugin cetraliza horizontalmente e verticalmente.

$("class_or_id").center();

Você pode também especificar a direção de alinhamento

$("class_or_id").center({
 
    horizontal: false // somente vertical
 
});
 
$("class_or_id").center({
 
vertical: false //somente horizontal
 
});

O plugin no site do jQuery

http://plugins.jquery.com/project/elementcenter

Suporte

Este plugin foi testado no IE 6, IE 7, Safari 3, Firefox 2+

Dependências

Este plugin requer o Dimensions plugin para funcionar corretamente

Página de teste

http://www.alexandremagno.net/jquery/plugins/center

Documentação original

http://code.google.com/p/jquerydevbrazil/wiki/jQueryCenterPlugin

Download

http://code.google.com/p/jquerydevbrazil/downloads/list

Autor

Alexandre Magno - http://www.alexandremagno.net

Licença

http://www.opensource.org/licenses/mit-license.php


Comentários

Assine o RSS para comentários

Rogério comentou:

23rd Março, 2008 às 11:08 pm

Obrigado por incrementar.

Ótima dica.

vlw!!!

Tales comentou:

24th Março, 2008 às 10:53 am

Boa Alex!
A maioria dos desenvolvedores HTML/CSS precisam centralizar elementos. Bem prático e fácil de usar o plugin.

Parabéns! :>)

john comentou:

26th Março, 2008 às 2:50 am

Hi, I came across your plugin looks good. I have a question of why you chose GPL over MIT or BSD license for a simple utility. Using the gpl will cause people pass over it since it would require them to license all of their code under the gpl.

Good work by the way.

admin comentou:

26th Março, 2008 às 9:42 am

Good point John. After a research I moved to MIT license. I would like the orientation to how I can put my plugins in jQuery plugins repository…

Very thanks…

h0tzen comentou:

3rd Abril, 2008 às 3:54 pm

you have to add return this; to make the center()-method chainable!

admin comentou:

4th Abril, 2008 às 9:56 am

Take a look hotzen:
http://code.google.com/p/jquerydevbrazil/source/browse/trunk/jquery.center.js
I made the change… thanks for suggestion!

nuno comentou:

14th Abril, 2008 às 11:33 am

okay, mais uma vez subiste na minha consideração

um grande abraço and good dev

Wilton José comentou:

2nd Julho, 2008 às 2:26 pm

Muito bom o seu plugin estou usando e está funcionando bem no IE 6/7 e no firefox 2. Já no firefox 3 ele não funciona legal. Testei no Ubuntu 8.04 com o firefox 3.

[]s
Wilton

Deixe seu comentário

Os seguintes campos estão incorretos ou faltando

  • Listagem dos campos faltando
(Não será publicado) * Campos obrigatórios