SlideShare a Scribd company logo
Ing. Alejandro Lizardo Celiz
jQuery: facilitando la
construcción de sitios 2.0

       Ing. Alejandro Lizardo Celiz
jQuery: facilitando la
construcción de sitios 2.0

       Ing. Alejandro Lizardo Celiz
Carlitos Tévez




  Very emotional !
¿Que es jQuery?
 Es un framework javascript
¿Que es jQuery?
        Es un framework javascript


Existen otros como :
 • Prototype
 • YUI
 • Dojo
 • mooTools
¿Por qué jQuery?

- La curva de aprendizaje es mínima.
- La cantidad de plugins es enorme.
- En general se lleva bien con cualquier otra librería
- Tiene una comunidad muy accesible
Crecimiento




Según BuiltWith, una empresa dedicada a la generación de estadísticas relacionadas con
tecnologías web, jQuerry está siendo usado actualmente por el 31% de los top 10000
websites, y por casi el 40% de todos los sitios que examinan
¿Que necesito saber
     para usar jQuery?

- Conocimiento básico de javascript


- Noción de Document Object Model (DOM)
¿Que es el DOM?
Javascript vs jQuery
links = document. getElementByTagName(‘a’);

for (i=0; i < links.length; i++){
  links[i].style.display = ‘none’
}
Javascript vs jQuery
links = document. getElementByTagName(‘a’);

for (i=0; i < links.length; i++){
  links[i].style.display = ‘none’
}


$(‘a’).hide()
¿Cómo usar jQuery?
¿Cómo usar jQuery?
<script type=”text/javascript” src=”jquery.js”> </script>
<script type=”text/javascript” src=”miCodigo.js”> </script>


$(document).ready(function(){
     código...
})
Filosofía de jQuery

1. Encontrar algo en el HTML


2. Hacer algo con él
Selectores
1. $(‘#mi_ID’)        $(‘.mi_Clase’)   $(‘div’)
2. $(‘li:first’)

3. $(‘a[target=_blank’)
4. $(‘div:visible’)
5. $(‘a:eq(0)’)
6. $(‘div’, ‘#mi_ID’, ‘.mi_Clase’)
Métodos
$('div').addClass('color').fadeIn();


Insertando elementos
append(), appendTo(), before(), after()

Atributos
css(), attr(), html(), val(), addClass()

Eventos
bind(), trigger(), unbind(), live(), click()

Efectos
show(), fadeOut(), toggle(), animate()

Traversing
find(), is(), prevAll(), next(), hasClass()

Ajax
Atributos
Get                  Set

.attr(‘id’)          .attr(‘id’, ‘pie’)
.html()              .html(‘<p>hola </p>’)
.val()               .val(‘nuevo valor’)
.css(‘top’)          .css(‘top’, ‘50px’)
. hasClass(‘link’)   .addClass(‘oculto’)
Eventos
$(‘div[id=alerta]).click(function(){
      $(this).hide();
});


$(‘p’).hover(function(){
      $(this).css(‘color’, ‘red’)
});
Efectos y Animaciones
$("button").click(function () {
     $("p").slideToggle("slow");
   });


$("#right").click(function(){
  $(".block").animate({"left": "+=50px"}, "slow");
});

$("#left").click(function(){
  $(".block").animate({"left": "-=50px"}, "slow");
});
Traversing
  $("#miCelda");

<html>
 <body>
  <table><tr>
    <td></td>
    <td></td>
    <td id="miCelda">
    <td></td>
  </tr></table>
 </body>
</html>
Traversing
$("#miCelda").prevAll();

<html>
 <body>
  <table><tr>
    <td></td>
    <td></td>
    <td id="miCelda">
    <td></td>
  </tr></table>
 </body>
</html>
Traversing
$("#miCelda").prevAll().andSelf()

<html>
 <body>
  <table><tr>
    <td></td>
    <td></td>
    <td id="miCelda">
    <td></td>
  </tr></table>
 </body>
</html>
Traversing
$("table");

<html>
 <body>
  <table>...</table>
    <div>
     <p>Hola</p>
     <span>Chau</span>
   </div>
 </body>
</html>
Traversing
$("table").next()

<html>
 <body>
  <table>...</table>
    <div>
     <p>Hola</p>
     <span>Chau</span>
   </div>
 </body>
</html>
Traversing
$("table").next().find(“p”)

<html>
 <body>
  <table>...</table>
    <div>
     <p>Hola</p>
     <span>Chau</span>
   </div>
 </body>
</html>
Ajax
      $.ajax({
       type: 'POST/GET',
       url: url,
       data: data,
       success: success
       dataType: dataType
});

$.get(...)

$.post(...)
Ajax
$.get('ajax/prueba.html', function(data) {
    $('#contenido').html(data);
});


<html>
 <body>
    <div id=”contenido”>
     ....
   </div>
 </body>
</html>
Ajax
$.get('ajax/prueba.html', function(data) {
  data = extraer_contenido();
  $('#contenido').html(data);
});


<html>
 <body>
    <div id=”contenido”>
     <p>Esto es ajax !!!</p>
   </div>
 </body>
</html>
Plugins
    $.fn.miPlugin = function(){
  return this.each(function(){
      $(this).html("Esto es un plugin!!!");
  });
});




<html>
 <body>
    <div></div>
    <div></div>
 </body>
</html>
Plugins
$.fn.miPlugin = function(){
  return this.each(function(){
      $(this).html("Esto es un plugin!!!");
  });
});


$("div").miPlugin();

<html>
 <body>
    <div>Esto es un plugin!!!</div>
    <div>Esto es un plugin!!!</div>
 </body>
</html>
Plugins
Plugins
Muchas gracias !!!



@Rlizardoceliz

More Related Content

PDF
jQuery, simplificando el javascript
PPTX
Story line pp
 
PPTX
How To Establish CRI
PPTX
Play framework
PPTX
Dainan is beautiful place in taiwan
PDF
What Has Europe Ever Done for Us?
PDF
6957 June13 exam_paper
PPTX
A few of my favorite things
jQuery, simplificando el javascript
Story line pp
 
How To Establish CRI
Play framework
Dainan is beautiful place in taiwan
What Has Europe Ever Done for Us?
6957 June13 exam_paper
A few of my favorite things

Viewers also liked (9)

PPS
CSI Social Media
PPS
CSI Social Media
PDF
Revision booklet 6957 2016
PDF
Euro Myths
PDF
Innotech Alno2010 March 2010
PDF
Presenting Alno Geman Kitchens 2011
PPTX
Marketing 16th aug 2012
PPT
Power teams 9th aug 2012
PPTX
Salute to Business - Best Business Advice
CSI Social Media
CSI Social Media
Revision booklet 6957 2016
Euro Myths
Innotech Alno2010 March 2010
Presenting Alno Geman Kitchens 2011
Marketing 16th aug 2012
Power teams 9th aug 2012
Salute to Business - Best Business Advice
Ad

Similar to Mini charla jquery (13)

PPTX
Aspetos gerais de desenvolvimento web.
PPTX
PDF
HTML&CSS 1 - Introduction to HTML
PPTX
N03 app engineseminar
PPTX
ADO.NET Entity Framework 4
PDF
Core rest edgarsilva_v1
PDF
CodeFest 2010. Желтов А. — Погружение в Internet Explorer 9 для разработчиков
PPTX
Fatih BAZMAN CodeIgniter Sunumu
PDF
Komplexe Sites sauber aufbauen
PPSX
初识 Html5
PPTX
Türsteher für Bohnen
PDF
Einfuehrung in YAML (2010)
PDF
03 3-create-db-application-ado-dot-net Create Database Application with using...
Aspetos gerais de desenvolvimento web.
HTML&CSS 1 - Introduction to HTML
N03 app engineseminar
ADO.NET Entity Framework 4
Core rest edgarsilva_v1
CodeFest 2010. Желтов А. — Погружение в Internet Explorer 9 для разработчиков
Fatih BAZMAN CodeIgniter Sunumu
Komplexe Sites sauber aufbauen
初识 Html5
Türsteher für Bohnen
Einfuehrung in YAML (2010)
03 3-create-db-application-ado-dot-net Create Database Application with using...
Ad

Mini charla jquery