Este é um pequeno exemplo de animação com jQuery. Claro que a parte mais importante são os seletores, que aqui estão apenas expressos por class e id.

Copie o código, cole no Dreamweaver e salve como “jquery.html” e veja o resultado.
- <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
- <html xmlns=”http://www.w3.org/1999/xhtml”>
- <head>
- <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
- <title>Página usando jQuery</title>
- <script type=”text/javascript” src=”http://code.jquery.com/jquery-1.7.1.min.js”></script>
- <script type=”text/javascript”>
- $(document).ready(function(){
- $(‘#botao’).click(function(){
- $(‘.anima’).animate({‘marginLeft’:’250px’},1000);
- });
- $(‘.anima’).css(‘background-color’, ‘#09F’);
- $(‘.anima’).css(‘width’, ’50px’);
- $(‘.anima’).css(‘height’, ’50px’);
- });
- </script>
- </head>
- <body>
- <input type=”button” value=”Clique aqui para animar” id=”botao” />
- <div class=”anima”></div>
- </body>
- </html>
Veja o exemplo abaixo: