Diferencia entre revisiones de «Usuario:Juanda/phonegap/jquerymobile»
De WikiEducator
(→Con jQuery Mobile) |
|||
| (7 revisiones intermedias por el mismo usuario no mostrado) | |||
| Línea 26: | Línea 26: | ||
:[http://m.stanford.edu/ Universidad de Stanford] | :[http://m.stanford.edu/ Universidad de Stanford] | ||
:[http://www.jqmgallery.com/ Y muchos más] | :[http://www.jqmgallery.com/ Y muchos más] | ||
| + | *Para ver las páginas correctamente: | ||
| + | :Instala la extensión para Chrome Google Chrome to Phone para ver las páginas en el móvil | ||
| + | :Cambia el user-agent del navegador (lo más fácil es mediante las Chrome Developer Tools). | ||
</div> | </div> | ||
| − | |||
<div class="slide"> | <div class="slide"> | ||
| Línea 445: | Línea 447: | ||
==Eventos en jQueryMobile== | ==Eventos en jQueryMobile== | ||
</div> | </div> | ||
| − | <div> | + | <div class="slide"> |
====Sin jQuery Mobile==== | ====Sin jQuery Mobile==== | ||
*Normalmente definimos los eventos mediante algún framework, por ejemplo jQuery. | *Normalmente definimos los eventos mediante algún framework, por ejemplo jQuery. | ||
| Línea 481: | Línea 483: | ||
*Taphold (al menos 1s) | *Taphold (al menos 1s) | ||
*Swipe (Swipeleft y Swiperight) | *Swipe (Swipeleft y Swiperight) | ||
| − | + | *Mira el siguiente código y [http://www.media.formandome.es/phonegap/eventojqmobile.html analiza su comportamiento] (es útil la extensión para'' Chrome Google Chrome to Phone''). | |
| − | + | ||
<source lang="html4strict"> | <source lang="html4strict"> | ||
<!DOCTYPE html> | <!DOCTYPE html> | ||
<html> | <html> | ||
<head> | <head> | ||
| − | <title> | + | <meta charset="utf-8"> |
| + | <title>Eventos con jQueryMobile</title> | ||
<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" /> | ||
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | ||
| Línea 507: | Línea 509: | ||
$("#swiperight").on("swiperight", function() { | $("#swiperight").on("swiperight", function() { | ||
alert("Swipe Right Event"); | alert("Swipe Right Event"); | ||
| + | }); | ||
| + | $(window).on('orientationchange', function(event){ | ||
| + | $("#placeholder").html("Se ha cambiado la orientación a: "+event.orientation); | ||
}); | }); | ||
}); | }); | ||
| Línea 512: | Línea 517: | ||
</head> | </head> | ||
<body> | <body> | ||
| − | |||
<div data-role="page" id="main"> | <div data-role="page" id="main"> | ||
<div data-role="header"> | <div data-role="header"> | ||
<h1> | <h1> | ||
| − | + | Eventos en jQueryMobile | |
</h1> | </h1> | ||
</div> | </div> | ||
<div data-role="content"> | <div data-role="content"> | ||
| − | < | + | <h3> |
| − | + | Eventos de cambio de orientación: | |
| − | </ | + | </h3> |
| + | <h3> | ||
| + | Eventos táctiles: | ||
| + | </h3> | ||
<p id="tap"> | <p id="tap"> | ||
| − | + | Pulsa aquí | |
</p> | </p> | ||
<p id="taphold"> | <p id="taphold"> | ||
| − | + | Pulsa y manten el dedo al menos 1s | |
</p> | </p> | ||
<p id="swipe"> | <p id="swipe"> | ||
| − | + | Desliza el dedo | |
</p> | </p> | ||
<p id="swipeleft"> | <p id="swipeleft"> | ||
| − | + | Desliza el dedo hacia la izqda | |
</p> | </p> | ||
<p id="swiperight"> | <p id="swiperight"> | ||
| − | + | Desliza el dedo hacia la dcha. | |
</p> | </p> | ||
</div> | </div> | ||
| Línea 545: | Línea 552: | ||
</div> | </div> | ||
</div> | </div> | ||
| − | |||
</body> | </body> | ||
</html> | </html> | ||
Última revisión de 15:20 20 feb 2014
| Trabajo en proceso, espera cambios frecuentes. Tu ayuda y retroalimentación son bienvenidos. Ver página de charlas. |