PageRenderTime 80ms CodeModel.GetById 51ms RepoModel.GetById 1ms app.codeStats 0ms

/Presentacion/src/jquery3.tex

https://github.com/waltervargas/WebDesign
LaTeX | 268 lines | 228 code | 39 blank | 1 comment | 0 complexity | 9c4f3121e3ebe7b6f823dc5649ae3753 MD5 | raw file
  1. \input{preambulo.tex}
  2. % Titulo
  3. \title[WebDesign] {Diseño Web | Tecnologías Involucradas}
  4. \author[Walter Vargas]{ info@covetel.com.ve \inst{1}}
  5. \subtitle{JQuery}
  6. \institute[covetel.com.ve]{ \inst{1} Cooperativa Venezolana de Tecnologías Libres R.S. }
  7. \date
  8. \begin{document}
  9. \begin{frame} % (fold)
  10. \titlepage
  11. \end{frame}
  12. \begin{frame} % (fold)
  13. \tableofcontents
  14. \end{frame}
  15. \section{Métodos de Efecto} % (fold)
  16. \subsection{Efectos Pre-empaquetados} % (fold)
  17. \begin{frame}[fragile]{Efectos Pre-empaquetados} % (fold)
  18. \begin{itemize}
  19. \item .show([speed][, callback]) \textit{ speed= una cadena o un número para determinar cuánto tiempo se ejecutara la animación.}
  20. \textit{callback= una función para saber cuando ha finalizado la animación.}
  21. \begin{lstlisting}
  22. <div class="content">
  23. <div class="trigger button">Trigger</div>
  24. <div class="target"><img src="hat.gif" width="80" height="54"></div>
  25. <div class="long"></div>
  26. </div>
  27. \end{lstlisting}
  28. \begin{lstlisting}
  29. $('.trigger').click(function() {
  30. $('.target').show('slow', function() {
  31. $(this).log('Effect Complete.');
  32. });
  33. });
  34. \end{lstlisting}
  35. \item .hide().
  36. \item .toggle().
  37. \item .slideDown() .slideUp() .slideToggle()
  38. \item .fadeIn() .fadeOut() .fadeTo()
  39. \end{itemize}
  40. \end{frame}
  41. \subsection{Efectos Personalizados} % (fold)
  42. \begin{frame}[fragile]{Efectos Personalizados} % (fold)
  43. \begin{itemize}
  44. \item .animate(properties [, speed][, easing][, callback]) \textit{
  45. properties= un mapa de propiedades CSS por los que se moverá la animación.}
  46. \textit{ speed= una cadena o un número para determinar el tiempo que se ejecutara la animación.}
  47. \textit{ easing= una cadena facilita el uso de la función en la transición.}
  48. \textit{ callback= una función para saber cuando ha finalizado la animación.}
  49. \begin{lstlisting}
  50. <div class="content">
  51. <div class="trigger button">Trigger</div>
  52. <div class="target"><img src="hat.gif" width="80" height="54"></div>
  53. <div class="long"></div>
  54. </div>
  55. \end{lstlisting}
  56. \begin{lstlisting}
  57. $('.trigger').click(function () {
  58. $('.target').animate({
  59. 'width': 300,
  60. 'left': 100,
  61. 'opacity': 0.25
  62. }, 'slow', function() {
  63. $(this).log('Effect Complete');
  64. });
  65. });
  66. \end{lstlisting}
  67. \end{itemize}
  68. \end{frame}
  69. \section{Métodos AJAX} % (fold)
  70. \subsection{Interfaz de Bajo Nivel} % (fold)
  71. \begin{frame}[fragile]{Interfaz de Bajo Nivel} % (fold)
  72. \begin{itemize}
  73. \item .ajax(settings) \textit{ settings= un mapa que contiene las siguientes opciones para loas solicitudes:}
  74. \begin{itemize}
  75. \item url.
  76. \item dataType.
  77. \item timeout.
  78. \item error.
  79. \item success.
  80. \end{itemize}
  81. \begin{lstlisting}
  82. $.ajax({
  83. url: 'ajax/test.html',
  84. success: function(data) {
  85. $('.result').html(data);
  86. $().log('Load was performed');
  87. },
  88. });
  89. \end{lstlisting}
  90. \item .ajaxSetup(settings) \textit{ settings= un mapa de opciones para
  91. solicitudes a futuro.}
  92. \begin{lstlisting}
  93. $.ajaxSetup({
  94. url: 'ping.php',
  95. });
  96. \end{lstlisting}
  97. \end{itemize}
  98. \end{frame}
  99. \subsection{Métodos de Taquigrafía} % (fold)
  100. \begin{frame}[fragile]{Métodos de Taquigrafía} % (fold)
  101. \begin{itemize}
  102. \item .get(url[, data][, success]) \textit{ url= una cadena que contiene la URL donde la solicitud debe ser enviada.}
  103. \textit{ data= un mapa de datos enviados con la solicitud.}
  104. \textit{ success= una función que se ejecuta cuando la solicitud a sido procesada.}
  105. \begin{lstlisting}
  106. $.get('ajax/test.html', function (data) {
  107. $('.result').html(data);
  108. $().log('Load was performed');
  109. })
  110. \end{lstlisting}
  111. \item .getModified().
  112. \item .loadModified().
  113. \item .post().
  114. \end{itemize}
  115. \end{frame}
  116. \begin{frame}[fragile]{Métodos de Taquigrafía} % (fold)
  117. \begin{itemize}
  118. \item .load(url[, data][, success]) \textit{ url= una cadena que contiene la URL donde la solicitud debe ser enviada.}
  119. \textit{ data= un mapa de datos enviados con la solicitud.}
  120. \textit{ success= una función que se ejecuta cuando la solicitud a sido procesada.}
  121. \begin{lstlisting}
  122. $('.result').load('ajax/test.html');
  123. \end{lstlisting}
  124. \item .getJSON(url[, data][, success]) \textit{ url= una cadena que contiene la URL donde la solicitud debe ser enviada.}
  125. \textit{ data= un mapa de datos enviados con la solicitud.}
  126. \textit{ success= una función que se ejecuta cuando la solicitud a sido procesada.}
  127. \begin{lstlisting}
  128. $.getJSON('ajax/test.json', function(data) {
  129. $('.result').html('<p> + data.foo + '</p><p>' + data.baz[1] + '</p>');
  130. $().log('Load was performed');
  131. });
  132. \end{lstlisting}
  133. \item .getScript().
  134. \end{itemize}
  135. \end{frame}
  136. \subsection{Controladores Globales de Eventos} % (fold)
  137. \begin{frame}[fragile]{Controladores Globales de Eventos} % (fold)
  138. \begin{itemize}
  139. \item .ajaxComplete(handler) \textit{ handler= la función que se invoca.}
  140. \begin{lstlisting}
  141. $('.log').ajaxComplete(function() {
  142. $(this).log('Triggered ajaxComplete handler');
  143. });
  144. \end{lstlisting}
  145. \item .ajaxError().
  146. \item .ajaxStart().
  147. \item .ajaxStop().
  148. \item .ajaxSuccess().
  149. \item .ajaxSend(handler) \textit{ handler= la función que se invoca.}
  150. \begin{lstlisting}
  151. $('.log').ajaxSend(function() {
  152. $(this).log('Triggered ajaxSend handler');
  153. });
  154. \end{lstlisting}
  155. \end{itemize}
  156. \end{frame}
  157. \subsection{Funciones de Ayuda} % (fold)
  158. \begin{frame}[fragile]{Funciones de Ayuda} % (fold)
  159. \begin{itemize}
  160. \item .serialize(param)
  161. \begin{lstlisting}
  162. <form>
  163. <div><input type="text" name="a" value="1" id="a" /></div>
  164. <div><input type="text" name="b" value="2" id="b" /></div>
  165. <div><input type="text" name="c" value="3" id="c" /></div>
  166. <div><textarea name="d" rows="8" cols="40">4</textarea></div>
  167. <div><select name="e">
  168. <option value="5" selected="selected">5</option>
  169. <option value="6">6</option><option value="7">7</option>
  170. </select></div>
  171. <div><input type="checkbox" name="f" value="8" id="f" /></div>
  172. <div><input type="submit" name="g" value="Submit" id="g" /></div>
  173. </form>
  174. \end{lstlisting}
  175. \begin{lstlisting}
  176. $('form').submit(function() {
  177. $(this).log($('input, textarea, select').serialize());
  178. return false;
  179. });
  180. \end{lstlisting}
  181. \end{itemize}
  182. \end{frame}
  183. \section{Otros Métodos} % (fold)
  184. \subsection{Otros Métodos} % (fold)
  185. \begin{frame}[fragile]{Métodos de Codificación y decodificación base-64} % (fold)
  186. \begin{itemize}
  187. \item .atob() \textit{Método que decodifica una cadena codificada en base-64.}
  188. \item .btoa() \textit{Método para codificar una cadena en base-64. Este método utiliza los caracteres A-Z, a-z, 0-9, +, / y = para la codificación de una cadena.}
  189. \end{itemize}
  190. \textbf{Ejemplo}
  191. \begin{lstlisting}
  192. <html>
  193. <head>
  194. <script type="text/javascript">
  195. function EncodeDecode () {
  196. input = document.getElementById ("myInput");
  197. encodedData = window.btoa (input.value);
  198. alert ("encoded data: " + encodedData);
  199. decodedData = window.atob (encodedData);
  200. alert ("decoded data: " + decodedData);
  201. }
  202. </script>
  203. </head>
  204. <body>
  205. <input type="text" id="myInput" value="The text to encode"/>
  206. <button onclick="EncodeDecode ();">Encode in base-64!</button>
  207. </body>
  208. </html>
  209. \end{lstlisting}
  210. \end{frame}
  211. \begin{frame}[fragile]{JSON.parse} % (fold)
  212. Método para convertir un array en Objeto.
  213. \begin{itemize}
  214. \item Usando JavaScript
  215. \textbf{Ejemplo}
  216. \begin{lstlisting}
  217. var JsonString = '[{"name": "Jhon", "apellido":"Smith"}]';
  218. var JsonObjects = JSON.parse(JsonString);
  219. alert(JsonObjects);
  220. \end{lstlisting}
  221. \item Usando JQuery
  222. \textbf{Ejemplo}
  223. \begin{lstlisting}
  224. var obj = jQuery.parseJSON('{"name": "Jhon", "apellido":"Smith"}');
  225. alert(obj.name === "Jhon");
  226. \end{lstlisting}
  227. \end{itemize}
  228. \end{frame}
  229. \end{document}