Diferencia entre revisiones de «Usuario:Juanda/phonegap/jquerymobile»

De WikiEducator
Saltar a: navegación, buscar
(Tipo de aplicaciones Web con PhoneGap)
(Plantilla html)
Línea 82: Línea 82:
 
<div class="slide">
 
<div class="slide">
  
===Plantilla html===
+
===Cómo empezar===
 
*Visitar [http://jquerymobile.com/download/ página jQueryMobile] para su descarga.
 
*Visitar [http://jquerymobile.com/download/ página jQueryMobile] para su descarga.
*Mejor utilizar un CDN:
+
*Leer el tutorial que incluye.
 +
*Creamos una plantilla para empezar a trabajar, mejor utilizar un CDN:
 
<source lang="bash">
 
<source lang="bash">
 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
 
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
Línea 90: Línea 91:
 
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
 
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
 
</source>
 
</source>
 +
 +
*Utilizaremos el atributo data-role para definir las distintas partes de nuestra aplicación o sitio web:
 +
<source lang="bash">
 +
<!DOCTYPE HTML>
 +
  <html>
 +
    <head>
 +
      <title>jQuery Mobile Demo</title>
 +
      <link href="jquery.mobile-1.0rc2.min.css" rel="stylesheet" type="text/css"/>
 +
      <script src="jquery-1.6.4.min.js"></script>
 +
      <script src="jquery.mobile-1.0rc2.min.js"></script>
 +
    </head>
 +
  <body>
 +
    <!-- Page Start-->
 +
    <div data-role="page">
 +
      <!-- Page Header Start -->
 +
      <div data-role="header">
 +
        <h1>Page Title</h1>
 +
      </div>
 +
      <!-- Page Header End -->
 +
      <!-- Page Body Start -->
 +
      <div data-role="content">
 +
        <p>Page content goes here.</p>
 +
      </div>
 +
      <!-- Page Body End -->
 +
      <!-- Page Footer Start -->
 +
      <div data-role="footer">
 +
        <h4> Page Footer</h4>
 +
      </div>
 +
      <!-- Page Footer End -->
 +
    </div>
 +
    <!-- Page End -->
 +
  </body>
 +
</html>
 +
</source>
 +
 
</div>
 
</div>
 
<div class="slide">
 
<div class="slide">

Revisión de 03:54 29 may 2013

Road Works.svg Trabajo en proceso, espera cambios frecuentes. Tu ayuda y retroalimentación son bienvenidos.
Ver página de charlas.
Road Works.svg




¿Qué es jQuery Mobile

  • Framework para crear intefaces de usuario basadas en HTML5
-Nos abstrae de las diferencias para el desarrollo entre los distintos navegadores.

-Write less, do more (jQuery) -Diseño atractivo "out of the box": hacen diseñador al programador.

  • Construido a partir de la librería jQuery y de jQueryUI
  • Orientado especificamente para móviles

Diseño responsivo

  • Uso de CSS media queries: hojas de estilo css especificas para dispositivos según anchura de pantalla, resolución o características.
  • Grid fluido, especificando sus elementos mediante unidades relativas.
  • Imágenes y media también en unidades relativas.

Diseño responsable

  • Se utiliza el criterio "mobile first":
Diseños sencillos
Diseños más complejos mediante media queries y siempre con un min-width
Se evita llevar un diseño pesado y aligerarlo para conseguir un time load aceptable para la red 3G.
  • Imágenes específicas para el tamaño de pantalla de los móviles, tanto por ancho de banda como por tamaño de pantalla, ver ejemplo
  • Uso de versiones minified y gzip

Ejemplo CSS Mobile First

  • Las media queries en ems en vez de pixeles para asegurarnos que el layout se adaptará al cambio del tamaño de las fuentes, además de al ancho de pantalla.
  • Para calcular la anchura en ems, se divide en ancho de nuestro objetivo entre 16px (tamaño de letra por defecto)
  • Aplicaciones Web accesibles via navegador
/* Start with core styles outside of a media query that apply to mobile and up */
/* Global typography and design elements, stacked containers */
body { font-family: Helvetica, san-serif; }
H1 { color: green; }
a:link { color:purple; }
 
/* Stack the two content containers */
.main,
.sidebar { display:block; width:100%; }
 
/* First breakpoint at 576px */
/* Inherits mobile styles, but floats containers to make columns */
@media all and (min-width: 36em){
	.main { float: left; width:60%; }
	.sidebar { float: left; width:40%; }
}
 
/* Second breakpoint at 800px */
/* Adjusts column proportions, tweaks base H1 */
@media all and (min-width: 50em){
	.main { width:70%; }
	.sidebar { width:30%; }
 
	/* You can also tweak any other styles in a breakpoint */
	H1 { color: blue; font-size:1.2em }
}

Cómo empezar

  • Visitar página jQueryMobile para su descarga.
  • Leer el tutorial que incluye.
  • Creamos una plantilla para empezar a trabajar, mejor utilizar un CDN:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
  • Utilizaremos el atributo data-role para definir las distintas partes de nuestra aplicación o sitio web:
<!DOCTYPE HTML>
  <html>
    <head>
      <title>jQuery Mobile Demo</title>
      <link href="jquery.mobile-1.0rc2.min.css" rel="stylesheet" type="text/css"/>
      <script src="jquery-1.6.4.min.js"></script>
      <script src="jquery.mobile-1.0rc2.min.js"></script>
    </head>
  <body>
    <!-- Page Start-->
    <div data-role="page">
      <!-- Page Header Start -->
      <div data-role="header">
        <h1>Page Title</h1>
      </div>
      <!-- Page Header End -->
      <!-- Page Body Start -->
      <div data-role="content">
        <p>Page content goes here.</p>
      </div>
      <!-- Page Body End -->
      <!-- Page Footer Start -->
      <div data-role="footer">
        <h4> Page Footer</h4>
      </div>
      <!-- Page Footer End -->
    </div>
    <!-- Page End -->
  </body>
</html>