<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>unijimpe &#187; AJAX</title> <atom:link href="http://blog.unijimpe.net/category/ajax/feed/" rel="self" type="application/rss+xml" /><link>http://blog.unijimpe.net</link> <description>Desarrollo Web, SEO, Adsense</description> <lastBuildDate>Mon, 28 Nov 2011 03:18:21 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Sikbox: Live Search en tu Web</title><link>http://blog.unijimpe.net/sikbox-live-search-en-tu-web/</link> <comments>http://blog.unijimpe.net/sikbox-live-search-en-tu-web/#comments</comments> <pubDate>Mon, 17 Nov 2008 05:08:52 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Servicios Web]]></category> <category><![CDATA[buscador]]></category> <category><![CDATA[excel]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[yahoo]]></category><guid isPermaLink="false">http://blog.unijimpe.net/?p=966</guid> <description><![CDATA[<p><a href="http://sikbox.com/">Sikbox</a> es un servicio que te permitirá incluir un buscador que uso de <em>AJAX</em> para mostrar los resultados automáticamente, se pueden configurar la interface y los resultados ademas de tener búsqueda de texto o de imágenes.&#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://sikbox.com/">Sikbox</a> es un servicio que te permitirá incluir un buscador que uso de <em>AJAX</em> para mostrar los resultados automáticamente, se pueden configurar la interface y los resultados ademas de tener búsqueda de texto o de imágenes.</p><p style="text-align:center;"><a href="http://sikbox.com/"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/11/sikbox.gif" alt="" title="sikbox" width="150" height="60" /></a></p><p><strong>Sikbox</strong> esta basado en <a href="http://developer.yahoo.com/search/boss/">Yahoo! Search BOSS</a> para obtener los resultados y <a href="http://jquery.com/">jQuery</a> para los efectos y AJAX. Incluye dos tipos de búsqueda: texto e imágenes además de mostrar los resultados con paginación en una misma interfaz.</p><p style="text-align:center;"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/11/sikbox-demo.gif" alt="" title="sikbox-demo" width="353" height="291" /></p><p><strong>Como utilizar Sikbox</strong><br /> El uso de este servicio es muy sencillo para ello solo hace falta incluir una línea de código en nuestro web. El código consiste en una llamada a un archivo Javascript de la forma:</p><div class="syntax_hilite"><div id="html-2"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://sikbox.com/magic.js?d=domain.com&amp;r=5&amp;s=grey"</span></div></li><li style="color:#26536A;"><div style="">&nbsp;<span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Donde se tienen los siguientes parámetros URL los cuales sirven para configuración:</p><ul><li><strong>d</strong>: es el nombre dominio donde se realizará la búsqueda</li><li><strong>r</strong>: numero de resultados a mostrar por pagina.</li><li><strong>s</strong>: estilo a aplicar para los resultados (<em>default</em>, <em>bezel</em>, <em>dark</em>, <em>grey</em>, <em>minimalist</em>).</li></ul><p>Como pueden ver el servicio es muy potente y muy sencillo de implementar, en definitiva una excelente herramienta que facilitará la búsqueda de información para nuestros visitantes.</p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/sikbox-live-search-en-tu-web/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>TableSorter jQuery Plugin</title><link>http://blog.unijimpe.net/tablesorter-jquery-plugin/</link> <comments>http://blog.unijimpe.net/tablesorter-jquery-plugin/#comments</comments> <pubDate>Thu, 16 Oct 2008 06:08:53 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[box.net]]></category> <category><![CDATA[email]]></category> <category><![CDATA[gmail]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[PNG]]></category> <category><![CDATA[yahoo]]></category><guid isPermaLink="false">http://blog.unijimpe.net/?p=933</guid> <description><![CDATA[<p><a href="http://tablesorter.com/docs/">TableSorter</a> es un plugin para jQuery que te pemitirá convertir las tradicionales tablas de datos en tablas interactivas con la posibilidad de ordenar los datos por columnas y todo ello con pocas líneas de código.</p><p style="text-align:center;"><a href="http://tablesorter.com/docs/"></a></p><p>Entre &#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://tablesorter.com/docs/">TableSorter</a> es un plugin para jQuery que te pemitirá convertir las tradicionales tablas de datos en tablas interactivas con la posibilidad de ordenar los datos por columnas y todo ello con pocas líneas de código.</p><p style="text-align:center;"><a href="http://tablesorter.com/docs/"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/10/tablesorter.gif" alt="" title="tablesorter" width="194" height="56" /></a></p><p>Entre las características mas destacables tenemos: ordenamiento por múltiples columnas, interpreta y ordena por texto, URLs, enteros, moneda, números flotantes, direcciones IP, fecha, hora entre otros. Adicionalmente es soportado en la mayoría de browsers (<em>IE 6.0+</em>, <em>FF 2+</em>, <em>Safari 2.0+</em>, <em>Opera 9.0+</em>).</p><p><strong>Utilizando TableSorter</strong><br /> Para utilizar esta librería lo primero es descargar la ultima versión de <a href="http://jquery.com/">jQuery</a> y luego el archivo <a href="http://tablesorter.com/jquery.tablesorter.min.js">jquery.tablesorter.js</a>. Luego de ello incluimos estas librerías en el header de nuestro HTML.</p><div class="syntax_hilite"><div id="html-6"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/jquery.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/jquery.tablesorter.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Lo siguiente es incluir nuestra tabla de forma normal, teniendo cuidado en asignarle un identificador y utilizar los tags <em>thead</em> y <em>tbody</em> para separar los títulos del contenido en la tabla como se muestra a continuación.</p><div class="syntax_hilite"><div id="html-7"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/table.html"><span style="color: #000000;">&lt;table</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"myTable"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/thead.html"><span style="color: #000000;">&lt;thead&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000;">&lt;tr&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000;">&lt;th&gt;</span></a></span>Last Name<span style="color: #009900;"><span style="color: #000000;">&lt;/th&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000;">&lt;th&gt;</span></a></span>First Name<span style="color: #009900;"><span style="color: #000000;">&lt;/th&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000;">&lt;th&gt;</span></a></span>Email<span style="color: #009900;"><span style="color: #000000;">&lt;/th&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000;">&lt;th&gt;</span></a></span>Due<span style="color: #009900;"><span style="color: #000000;">&lt;/th&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/th.html"><span style="color: #000000;">&lt;th&gt;</span></a></span>Web Site<span style="color: #009900;"><span style="color: #000000;">&lt;/th&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/tr&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;</span></a>/thead&gt;</span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/tbody.html"><span style="color: #000000;">&lt;tbody&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000;">&lt;tr&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Smith<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>John<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>jsmith@gmail.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>$50.00<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>http://www.jsmith.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/tr&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000;">&lt;tr&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Bach<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Frank<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>fbach@yahoo.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>$50.00<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>http://www.frank.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/tr&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000;">&lt;tr&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Doe<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Jason<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>jdoe@hotmail.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>$100.00<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>http://www.jdoe.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/tr&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000;">&lt;tr&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Conway<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>Tim<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>tconway@earthlink.net<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>$50.00<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/td.html"><span style="color: #000000;">&lt;td&gt;</span></a></span>http://www.timconway.com<span style="color: #009900;"><span style="color: #000000;">&lt;/td&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/tr&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/tbody&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/table&gt;</span></span></div></li></ol></div></div></div><p></p><p>Para finalizar hacemos un llamado a la función <strong>tablesorter</strong> indicando mediante el identificador a que tabla le aplicamos el ordenamiento.</p><div class="syntax_hilite"><div id="html-8"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">$(document).ready(function()</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; {</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; $(&quot;#myTable&quot;).tablesorter();</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; }</div></li><li style="color:#26536A;"><div style="">);</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Con esto ya tenemos nuestra tabla con las opciones para ordenar, obviamente lo que le hace falta es aplicarlo estilos para mejorar la apariencia con lo cual logramos obtener un buen resultado como el mostrado a continuación.</p><p style="text-align:center;"><a href="http://samples.unijimpe.net/tablesorter/"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/10/tablesorter-demo.gif" alt="" title="tablesorter-demo" width="379" height="169" /></a></p><p>Obviamente este plugin tiene muchas opciones adicionales como definir ordenamientos iniciales, funciones para llamar al ordenamiento desde otros elementos entre otros, todo ello muy detallado y con ejemplos en el web original de <em>TableSorter</em>. Sin duda esta será una herramienta para mejorar la interactividad con la información que deseamos mostrar en nuestros webs.</p><p style="text-align:center;"><a href="http://www.box.net/shared/7i5vzolcu3"><img src="http://blog.unijimpe.net/btdown.png" border="0"></a></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/tablesorter-jquery-plugin/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>jqPuzzle: Puzzles con jQuery</title><link>http://blog.unijimpe.net/jqpuzzle-puzzles-con-jquery/</link> <comments>http://blog.unijimpe.net/jqpuzzle-puzzles-con-jquery/#comments</comments> <pubDate>Mon, 29 Sep 2008 18:23:34 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[plugin]]></category><guid isPermaLink="false">http://blog.unijimpe.net/?p=921</guid> <description><![CDATA[<p><a href="http://www.2meter3.de/jqPuzzle/">jqPuzzle</a> es un plugin para <strong>jQuery</strong> que te permitirá crear rápidamente Puzzles o rompecabezas utilizando cualquier imagen y así sorprender y entretener a tus amigos y familiares.</p><p style="text-align:center;"></p><p><strong>Utilizando jqPuzzle</strong><br /> Lo primero es descargar la librería <a href="http://jquery.com/">jQuery</a>&#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://www.2meter3.de/jqPuzzle/">jqPuzzle</a> es un plugin para <strong>jQuery</strong> que te permitirá crear rápidamente Puzzles o rompecabezas utilizando cualquier imagen y así sorprender y entretener a tus amigos y familiares.</p><p style="text-align:center;"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/09/jqpuzzle.jpg" alt="" title="jqpuzzle" width="400" height="162" /></p><p><strong>Utilizando jqPuzzle</strong><br /> Lo primero es descargar la librería <a href="http://jquery.com/">jQuery</a> y luego jqPuzzle en encontrarás los archivos <em>jquery.jqpuzzle.js</em> y la hoja de estilos <em>jquery.jqpuzzle.css</em>. Entonces el siguiente paso es incluir estos archivos en el header de nuestro HTML que deseamos.</p><div class="syntax_hilite"><div id="html-11"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"jquery.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"jquery.jqpuzzle.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/css"</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"jquery.jqpuzzle.css"</span> /<span style="color: #000000;">&gt;</span></a></span></div></li></ol></div></div></div><p></p><p>Luego de ello, incluimos una imagen en nuestro HTML y le asignamos el estilo jqPuzzle de la siguiente forma:</p><div class="syntax_hilite"><div id="html-12"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"photo.jpg"</span> <span style="color: #000066;">alt</span>=<span style="color: #ff0000;">"My Desktop"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"jqPuzzle"</span> /<span style="color: #000000;">&gt;</span></a></span></div></li></ol></div></div></div><p></p><p>Con esto ya tenemos nuestro puzzle funcionado, el cual tiene las opciones de mezclar los bloques, previsualizar la imagen original y mostrar los números con la posición de cada imagen. Una versión funcionando la pueden ver en <a href="http://samples.unijimpe.net/jqpuzzle/">jqPuzzle</a>.</p><p>El puzzle generado por defecto es de 4x4, si quieres modificar estos valores o modificar otras opciones adicionales puedes visitar la documentación de este plugin en <a href="http://www.2meter3.de/jqPuzzle/#howto">jqPuzzle: How to Use</a></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/jqpuzzle-puzzles-con-jquery/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>SimplePie Live</title><link>http://blog.unijimpe.net/simplepie-live/</link> <comments>http://blog.unijimpe.net/simplepie-live/#comments</comments> <pubDate>Sun, 21 Sep 2008 23:52:40 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[Servicios Web]]></category> <category><![CDATA[API]]></category> <category><![CDATA[box.net]]></category> <category><![CDATA[feed]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[gratuito]]></category> <category><![CDATA[JSON]]></category> <category><![CDATA[PNG]]></category> <category><![CDATA[proxy]]></category> <category><![CDATA[SimplePie]]></category><guid isPermaLink="false">http://blog.unijimpe.net/?p=906</guid> <description><![CDATA[<p>Los desarrolladores de <a href="http://simplepie.org">SimplePie</a> han lanzado un servicio gratuito y sin registro llamado <a href="http://live.simplepie.org/">SimplePie Live</a> que te permite crear e incluir un lector de Feeds en tu web, todo ello utilizando solamente Javascript.</p><p style="text-align:center;"><a href="http://live.simplepie.org/"></a></p><p>El servicio funciona &#8230;</p>]]></description> <content:encoded><![CDATA[<p>Los desarrolladores de <a href="http://simplepie.org">SimplePie</a> han lanzado un servicio gratuito y sin registro llamado <a href="http://live.simplepie.org/">SimplePie Live</a> que te permite crear e incluir un lector de Feeds en tu web, todo ello utilizando solamente Javascript.</p><p style="text-align:center;"><a href="http://live.simplepie.org/"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/09/simplepie-live.jpg" alt="" title="simplepie-live" width="160" height="54" /></a></p><p>El servicio funciona internamente con SimplePie y devuelve los resultados en <strong>JSON</strong> para que se pueda acceder a los resultados del Feed sin necesidad de ningún lenguaje de servidor, solamente <em>Javascript</em>.</p><p><strong>Como utilizar SimplePie Live</strong><br /> Para utilizar este servicio, lo primero es incluir la librería <em>base.js</em> directamente desde los servidores de SimplePie en el <em>header</em> de nuestro HTML.</p><div class="syntax_hilite"><div id="code-17"><div class="code"><ol><li style="color:#3A6A8B;"><div style="">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span></div></li><li style="color:#26536A;"><div style="">src=<span style="color:#CC0000;">"http://live.simplepie.org/app/0.5/base.js"</span>&gt;&lt;/script&gt;</div></li></ol></div></div></div><p></p><p>Luego podremos hacer uso de la función <em>SimplePie</em>, el cual recibe como parámetro el URL del Feed que deseamos leer y una función que se ejecutará cuando se haya completado la carga de los datos.</p><div class="syntax_hilite"><div id="javascript-18"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #003366;">var</span> feed = <span style="color: #003366;">new</span> SimplePie<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"URL"</span>, <span style="color: #66cc66;">&#123;</span>onSuccess: <span style="color: #003366;">function</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div><p></p><p>Ahora que ya conocemos la sintaxis, procedemos a crear las variables y procedimientos necesarios para  mostrar los datos devueltos por SimplePie. Previamente vamos a crear un div donde mostraremos los resultados.</p><div class="syntax_hilite"><div id="html-19"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"divfeed"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000;">&lt;p&gt;</span></a></span>Cargando...<span style="color: #009900;"><span style="color: #000000;">&lt;/p&gt;</span></span><span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li></ol></div></div></div><p></p><p>Primero, creamos una variable con el URL del Feed que vamos a leer, luego llamamos a la función SimplePie el cual ejecutará <em>showFeed</em> cuando se haya completado la carga de los datos.</p><div class="syntax_hilite"><div id="javascript-20"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #003366;">var</span> feedURL = <span style="color: #3366CC;">'http://feedproxy.google.com/unijimpe'</span>;</div></li><li style="color:#26536A;"><div style=""><span style="color: #003366;">var</span> feedDIV = document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'divfeed'</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #003366;">var</span> feedLIV = <span style="color: #003366;">new</span> SimplePie<span style="color: #66cc66;">&#40;</span>feedURL, <span style="color: #66cc66;">&#123;</span>onSuccess: showFeed<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#26536A;"><div style=""><span style="color: #003366;">var</span> tmp = <span style="color: #3366CC;">""</span>;</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #003366;">function</span> showFeed <span style="color: #66cc66;">&#40;</span>feed<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #003366;">var</span> qty = feed.<span style="color: #006600;">itemQuantity</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;p&gt;'</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;h2&gt;'</span>+feed.<span style="color: #006600;">title</span>+<span style="color: #3366CC;">'&lt;/h2&gt;'</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;em&gt;'</span>+ feed.<span style="color: #006600;">description</span>+<span style="color: #3366CC;">'&lt;/em&gt;'</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;/p&gt;'</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #000066;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366;">var</span> x = <span style="color: #CC0000;color:#800000;">0</span>; x &lt;qty; x++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366;">var</span> <span style="color: #000066;">item</span> = feed.<span style="color: #006600;">items</span><span style="color: #66cc66;">&#91;</span>x<span style="color: #66cc66;">&#93;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;p&gt;'</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;strong&gt;'</span> + <span style="color: #66cc66;">&#40;</span>x+<span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#41;</span> + <span style="color: #3366CC;">'. &lt;/strong&gt;'</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;a href=&quot;'</span>+<span style="color: #000066;">item</span>.<span style="color: #006600;">permalink</span>+<span style="color: #3366CC;">'&quot;&gt;'</span>+<span style="color: #000066;">item</span>.<span style="color: #006600;">title</span>+<span style="color: #3366CC;">'&lt;/a&gt;'</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;br&gt;'</span> + <span style="color: #3366CC;">'&lt;em&gt;'</span> + <span style="color: #000066;">item</span>.<span style="color: #006600;">date</span> + <span style="color: #3366CC;">'&lt;/em&gt;'</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;/p&gt;'</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; tmp+= <span style="color: #3366CC;">'&lt;p&gt;'</span> + <span style="color: #000066;">item</span>.<span style="color: #006600;">description</span>+ <span style="color: #3366CC;">'&lt;/p&gt;'</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; feedDIV.<span style="color: #006600;">innerHTML</span> = tmp;</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #66cc66;">&#125;</span></div></li></ol></div></div></div><p></p><p>Como podemos ver, dentro de la función <em>showFeed</em>, tenemos acceso a los datos devueltos, estos datos están dentro de una variable como un objeto por lo que podemos acceder a cada uno de sus elementos como si fueran propiedades por lo cual es muy fácil de generar nuestro código html para mostrarlo en web.</p><p style="text-align:center;"><a href="http://samples.unijimpe.net/simplepie-live/simplepie-live.html"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/09/simplepie-sample.gif" alt="" title="simplepie-sample" width="300" height="256" /></a></p><p>En nuestro caso hemos utilizado las propiedades básicas de un Feed (<em>title</em>, <em>data</em>, <em>description</em>) pero si deseas un referencia completa de métodos y propiedades puedes leer <a href="http://simplepie.org/wiki/live/reference/start">SimplePie Documentation: API Reference</a></p><p style="text-align:center;"><a href="http://www.box.net/shared/126d6gtzet"><img src="http://blog.unijimpe.net/btdown.png" border="0"></a></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/simplepie-live/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>FancyUpload</title><link>http://blog.unijimpe.net/fancyupload/</link> <comments>http://blog.unijimpe.net/fancyupload/#comments</comments> <pubDate>Thu, 31 Jul 2008 05:59:38 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[Flash]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[box.net]]></category> <category><![CDATA[click]]></category> <category><![CDATA[diseño]]></category> <category><![CDATA[eventos]]></category> <category><![CDATA[Mootools]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[PNG]]></category> <category><![CDATA[swf]]></category> <category><![CDATA[Tools]]></category><guid isPermaLink="false">http://blog.unijimpe.net/?p=872</guid> <description><![CDATA[<p><a href="http://digitarald.de/project/fancyupload/">FancyUpload</a> es una extensión de Mootools que permite hacer upload de archivos incluyendo barra de progreso. Esta basado en <em>Swiff</em> la clase de <em>Mootools</em> que permite incluir archivos SWF en HTML.</p><p style="text-align:center;"><a href="http://samples.unijimpe.net/fancyupload/"></a></p><p>Si hacemos uso de la &#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://digitarald.de/project/fancyupload/">FancyUpload</a> es una extensión de Mootools que permite hacer upload de archivos incluyendo barra de progreso. Esta basado en <em>Swiff</em> la clase de <em>Mootools</em> que permite incluir archivos SWF en HTML.</p><p style="text-align:center;"><a href="http://samples.unijimpe.net/fancyupload/"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/07/fancy-upload-demo.gif" alt="" width="375" height="171" /></a></p><p>Si hacemos uso de la etiqueta <em>input file</em> no se puede hacer un seguimiento del progreso del upload y mucho menos aplicar estilos para integrarse correctamente con nuestro diseño. Esta librería utiliza un SWF que contiene las funciones necesarias para detectar el progreso de la carga, restringir a determinado tipo de archivos, entre otras opciones las cuales son características de flash.</p><p><strong>Obteniendo los archivos</strong><br /> Lo primero es obtener los archivos necesarios: <em>mootools.js</em> desde <a href="http://mootools.net/core">Mootools</a>, luego los archivos <em>FancyUpload2.js</em>, <em>Swiff.Uploader.js</em>, <em>Fx.ProgressBar.js</em> y <em>Swiff.Uploader.swf</em> desde <a href="http://digitarald.de/project/fancyupload/">FancyUpload</a>.</p><p><strong>Incluyendo los archivos</strong><br /> Lo siguiente es incluir los archivos recién descargados en nuestro HTML (En nuestro caso hemos colocado los Javascript en una carpeta llamada <em>js</em>), esto lo hacemos de la forma:</p><div class="syntax_hilite"><div id="html-25"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/mootools.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/Swiff.Uploader.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/Fx.ProgressBar.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/FancyUpload2.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p><strong>Creando el Formulario</strong><br /> Lo que necesitamos crear son dos elementos, uno llamado <em>demo-status</em> que mostrará el progreso de la carga y <em>demo-list</em> que contiene la lista de archivos a subir. Además de ello necesitamos dos botones o links uno para seleccionar el archivo y el otro para iniciar el upload.</p><div class="syntax_hilite"><div id="html-26"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"demo-status"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"hide"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"#"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"demo-browse-all"</span><span style="color: #000000;">&gt;</span></a></span>Browse Files<span style="color: #009900;"><span style="color: #000000;">&lt;/a&gt;</span></span> |</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"#"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"demo-upload"</span><span style="color: #000000;">&gt;</span></a></span>Upload<span style="color: #009900;"><span style="color: #000000;">&lt;/a&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000;">&lt;strong</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"overall-title"</span><span style="color: #000000;">&gt;</span></a></span>Overall progress<span style="color: #009900;"><span style="color: #000000;">&lt;/strong&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000;">&lt;br</span></a> /<span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"img/bar.gif"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"progress overall-progress"</span> /<span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/strong.html"><span style="color: #000000;">&lt;strong</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"current-title"</span><span style="color: #000000;">&gt;</span></a></span>File Progress<span style="color: #009900;"><span style="color: #000000;">&lt;/strong&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000;">&lt;br</span></a> /<span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/img.html"><span style="color: #000000;">&lt;img</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"img/bar.gif"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"progress current-progress"</span> /<span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"current-text"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/ul.html"><span style="color: #000000;">&lt;ul</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"demo-list"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/ul&gt;</span></span></div></li></ol></div></div></div><p></p><p><strong>Implementando el Upload</strong><br /> Creamos una instancia de la clase <em>FancyUpload2</em> el cual recibe como parámetros el elemento html para el estado de la carga, el elemento para el listado de archivos y luego un array de opciones donde indicamos a donde enviar los archivos, cual será el nombre con el cual se enviaran los archivos y finalmente la ruta al swf que contiene las funciones necesarias para el funcionamiento de esta librería.</p><div class="syntax_hilite"><div id="javascript-27"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style="">window.<span style="color: #006600;">addEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'load'</span>, <span style="color: #003366;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #003366;">var</span> swiffy = <span style="color: #003366;">new</span> FancyUpload2<span style="color: #66cc66;">&#40;</span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'demo-status'</span><span style="color: #66cc66;">&#41;</span>,</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'demo-list'</span><span style="color: #66cc66;">&#41;</span>,</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'url'</span>: <span style="color: #3366CC;">'upload.php'</span>,</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'fieldName'</span>: <span style="color: #3366CC;">'archivo'</span>,</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #3366CC;">'path'</span>: <span style="color: #3366CC;">'Swiff.Uploader.swf'</span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'bt-browse'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'click'</span>, <span style="color: #003366;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; swiffy.<span style="color: #006600;">browse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">return</span> <span style="color: #003366;">false</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'bt-upload'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">addEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'click'</span>, <span style="color: #003366;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; swiffy.<span style="color: #006600;">upload</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">return</span> <span style="color: #003366;">false</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div><p></p><p>Hay que notar también que hemos agregado los eventos para los botones que abrirán el selector de archivos y el inicio del upload.</p><p><strong>Guardando los archivos con PHP</strong><br /> PHP recibe los archivos de forma normal y procedemos a guardarlo, para ello accedemos al archivo subido con el nombre asignado en el parámetro <em>fieldName</em>, entonces obviando la validación por propósitos de facilitar la explicación tendríamos:</p><div class="syntax_hilite"><div id="php-28"><div class="php"><ol><li style="color:#3A6A8B;"><div style=""><span style="color:#FF9933; font-style:italic;">// file: upload.php</span></div></li><li style="color:#26536A;"><div style=""><span style="color:#616100;">if</span> <span style="color:#006600;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600;">&#40;</span><span style="color:#0000FF;">$_FILES</span><span style="color:#006600;">&#91;</span><span style="color:#FF0000;">'archivo'</span><span style="color:#006600;">&#93;</span><span style="color:#006600;">&#41;</span><span style="color:#006600;">&#41;</span> <span style="color:#006600;">&#123;</span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color:#0000FF;">$file</span> = <span style="color:#0000FF;">$_FILES</span><span style="color:#006600;">&#91;</span><span style="color:#FF0000;">'archivo'</span><span style="color:#006600;">&#93;</span><span style="color:#006600;">&#91;</span><span style="color:#FF0000;">'tmp_name'</span><span style="color:#006600;">&#93;</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color:#0000FF;">$name</span> = <span style="color:#0000FF;">$_FILES</span><span style="color:#006600;">&#91;</span><span style="color:#FF0000;">"archivo"</span><span style="color:#006600;">&#93;</span><span style="color:#006600;">&#91;</span><span style="color:#FF0000;">'name'</span><span style="color:#006600;">&#93;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600;">&#40;</span><a href="http://www.php.net/copy"><span style="color:#000066;">copy</span></a><span style="color:#006600;">&#40;</span><span style="color:#0000FF;">$file</span>, <span style="color:#FF0000;">"files/"</span>.<span style="color:#0000FF;">$name</span><span style="color:#006600;">&#41;</span><span style="color:#006600;">&#41;</span> <span style="color:#006600;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$status</span> = <span style="color:#FF0000;">"Archivo subido: &lt;b&gt;"</span>.<span style="color:#0000FF;">$name</span>.<span style="color:#FF0000;">"&lt;/b&gt;"</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color:#006600;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$status</span> = <span style="color:#FF0000;">"Error al subir el archivo"</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color:#006600;">&#125;</span></div></li><li style="color:#26536A;"><div style=""><span style="color:#006600;">&#125;</span> <span style="color:#616100;">else</span> <span style="color:#006600;">&#123;</span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color:#0000FF;">$status</span> = <span style="color:#FF0000;">'Archivo vacio intentelo nuevamente!'</span>;</div></li><li style="color:#26536A;"><div style=""><span style="color:#006600;">&#125;</span></div></li><li style="color:#3A6A8B;"><div style=""><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#0000FF;">$status</span>;</div></li></ol></div></div></div><p></p><p>Pueden ver el ejemplo funcionando en: <a href="http://samples.unijimpe.net/fancyupload/">http://samples.unijimpe.net/fancyupload/</a> en donde se puede observar lo intuitiva que resulta ser la pantalla para subir archivos. Esto es muy importante por que le permite a los usuarios saber si efectivamente se esta subiendo los archivos y sobre todo que nos hemos olvidado del típico formulario al cual no se le podía aplicar estilos de forma adecuada.</p><p style="text-align:center;"><a href="http://www.box.net/shared/8m954lmo0w"><img src="http://blog.unijimpe.net/btdown.png" border="0"></a></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/fancyupload/feed/</wfw:commentRss> <slash:comments>41</slash:comments> </item> <item><title>Google AJAX Libraries API</title><link>http://blog.unijimpe.net/google-ajax-libraries-api/</link> <comments>http://blog.unijimpe.net/google-ajax-libraries-api/#comments</comments> <pubDate>Wed, 28 May 2008 03:59:14 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[API]]></category> <category><![CDATA[cache]]></category> <category><![CDATA[cookies]]></category> <category><![CDATA[Framework]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Mootools]]></category> <category><![CDATA[swf]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[video]]></category> <category><![CDATA[Youtube]]></category> <category><![CDATA[ZIP]]></category><guid isPermaLink="false">http://blog.unijimpe.net/?p=849</guid> <description><![CDATA[<p><a href="http://code.google.com/apis/ajaxlibs/">Google AJAX Libraries API</a> es un nuevo servicio mediante el cual Google aprovechando de su gran infraestructura alojará las principales <em>Frameworks Javascript</em> para enlazarlos directamente. Con ello podremos acelerar la carga de nuestras librerías y por &#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://code.google.com/apis/ajaxlibs/">Google AJAX Libraries API</a> es un nuevo servicio mediante el cual Google aprovechando de su gran infraestructura alojará las principales <em>Frameworks Javascript</em> para enlazarlos directamente. Con ello podremos acelerar la carga de nuestras librerías y por consiguiente una mejor velocidad de nuestras web.</p><p style="text-align:center;"><img src="http://blog.unijimpe.net/wp-content/uploads/2008/05/gajaxapi.gif" alt="" width="178" height="99"  /></p><p>Este servicio, tienes varias cualidades muy importantes:</p><ul><li><strong>Uso del Cache del Browser</strong>: Si un usuario visita una Web, descargará la librería desde Google. Si posteriormente entra a otra web que utiliza la misma librería, esta ya no se descargará nuevamente si no se utilizará la copia en el cache de navegador.</li><li><strong>Compresión Gzip</strong>: se encuentran habilitadas las transferencia de datos comprimidas en Gzip con lo cual hay menor transferencia de datos.</li><li><strong>Versiones minificadas</strong>: al llamar a una librería, se hará uso de las versiones minificadas, es decir donde se han eliminado los comentarios, saltos de linea, espacios en blanco innecesarios y reemplazado nombres de variables por otras mas cortas. Esto también acelera la carga del archivo.</li><li><strong>Archivos distribuidos por en CDN de Google</strong>: se utiliza toda la infraestructura de Google, por lo cual el archivo se puede obtener de cualquiera de lo muchos servidores alrededor del mundo con los que cuenta Google.</li><li><strong>Optimización de Header</strong>: se utilizaran <em>headers</em> innecesarios y tampoco se guardaran <em>cookies</em> lo cual es un ahorra de bytes.</li></ul><p>Inicialmente se han puesto a disposición las librerías mas populares, pero se planea ir aumentando estas a medida que los usuarios lo soliciten. Las librerías disponibles actualmente son: <a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery">jQuery</a>, <a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#prototype">prototype</a>, <a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#script_aculo_us">script.aculo.us</a>, <a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#mootools">MooTools</a>, <a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#dojo">dojo</a>.</p><p><strong>Como Utilizarlo</strong><br /> La forma mas sencilla de utilizar este servicio es enlazar directamente a los archivos utilizando el tag script como se hace normalmente, por ejemplo si deseamos cargar MooTools.</p><div class="syntax_hilite"><div id="html-30"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- versión minificada --&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools-yui-compressed.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- versión normal --&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://ajax.googleapis.com/ajax/libs/mootools/1.11/mootools.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Para mayor información acerca de este servicio pueden leer la documentación en <a href="http://code.google.com/apis/ajaxlibs/documentation/index.html">Developer's Guide</a>, también pueden leer una explicación mas detallada del modo de uso en <a href="http://www.anieto2k.com/2008/05/27/google-ajax-libraries-api-ajax-sobre-la-arquitectura-google/">Google Ajax Libraries API, ajax sobre la arquitectura Google</a> y finalmente les dejo un video con la presentación y explicación del funcionamiento de esta librería.</p><p> <object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/4F4Jb1ssEvI&amp;rel=0&amp;showsearch=0&amp;fs=1&amp;showinfo=0&amp;iv_load_policy=3"></param><param name="quality" value="high"></param><param name="wmode" value="transparent"></param><param name="menu" value="false"></param><param name="bgcolor" value="#FFFFFF"></param><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param> <embed type="application/x-shockwave-flash" width="425" height="355" src="http://www.youtube.com/v/4F4Jb1ssEvI&amp;rel=0&amp;showsearch=0&amp;fs=1&amp;showinfo=0&amp;iv_load_policy=3" quality="high" bgcolor="#FFFFFF" wmode="transparent" menu="false" allowFullScreen="true" ></embed> </object></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/google-ajax-libraries-api/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Introducción a Mootools</title><link>http://blog.unijimpe.net/introduccion-a-mootools/</link> <comments>http://blog.unijimpe.net/introduccion-a-mootools/#comments</comments> <pubDate>Thu, 28 Feb 2008 02:37:26 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Mootools]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[eventos]]></category> <category><![CDATA[Framework]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[Tools]]></category><guid isPermaLink="false">http://blog.unijimpe.net/introduccion-a-mootools/</guid> <description><![CDATA[<p><a href="http://mootools.net/">Mootools</a> es un <em>framework</em> Javascript muy potente que nos facilitará el desarrollo de interfaces visuales, efectos, manipulación del DOM, manejo de AJAX, entre otras muchas opciones. Además de ser muy ligera, tiene soporte para OOP y &#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://mootools.net/">Mootools</a> es un <em>framework</em> Javascript muy potente que nos facilitará el desarrollo de interfaces visuales, efectos, manipulación del DOM, manejo de AJAX, entre otras muchas opciones. Además de ser muy ligera, tiene soporte para OOP y además tiene multitud de plugins que te permitirán implementar variedad de aplicaciones fácilmente.</p><p style="text-align:center;"><img src='http://blog.unijimpe.net/wp-content/uploads/2008/02/mootools.gif' alt='mootools.gif' /></p><p><strong>Empezando con Mootools</strong><br /> Lo primero es descargar la librería, para ello puedes acceder a <a href="http://mootools.net/download">Download Mootools</a>, donde seleccionas los módulos a utilizar y el método de compresión, para nuestro caso seleccionamos todos los módulos. Descargaremos un archivo con el nombre <em>mootools-release-x.xx.js.txt</em> (Donde x.xx es la versión), el cual lo renombrados a <em>mootools.js</em> y lo colocamos al directorio de nuestro proyecto web.</p><p>El siguiente paso es incluir la librería en nuestro <em>html</em>, para poder utilizarlo, para ello colocamos en el header lo siguiente.</p><div class="syntax_hilite"><div id="html-36"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/mootools.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p><strong>Detectando los Eventos de Carga</strong><br /> Lo siguiente que debemos hacer el crear un detector de eventos para ejecutar nuestras acciones una vez que se ha cargado la página. Si se llama a las funciones cuando aun no se ha completado la carga se generar errores pues aun hay elementos que no están disponibles.</p><p>Para ello existen dos eventos: <strong>domready</strong> que se ejecuta cuando todos los elementos de la página están listos, pero no espera por las imágenes y <strong>load</strong> que se ejecuta cuando toda la página incluyendo las imágenes se ha cargado, entonces tendríamos:</p><div class="syntax_hilite"><div id="html-37"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">window.addEvent('domready', function() {</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp;// código - carga sin imágenes completa</div></li><li style="color:#26536A;"><div style="">});</div></li><li style="color:#3A6A8B;"><div style="">window.addEvent('load', function() {</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp;// código - carga con imágenes completa</div></li><li style="color:#3A6A8B;"><div style="">});</div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Obviamente es mas rápido <strong>domready</strong> pues no espera que se carguen las imágenes pero ya se tiene disponible todos los elementos de la página para manipularlos.</p><p><strong>La función $ (dolar)</strong><br /> La función <strong>$()</strong> es equivalente a <em>document.getElementById(</em>) con el cual se puede acceder a un elemento mediante su identificador. Veamos los siguientes ejemplos:</p><div class="syntax_hilite"><div id="javascript-38"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style="">document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'myDiv'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// accede a mydiv</span></div></li><li style="color:#26536A;"><div style="">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'myDiv'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// accede al elemento con id=mydiv </span></div></li></ol></div></div></div><p></p><p><strong>La función $$ (doble dolar)</strong><br /> La función <strong>$$()</strong> es equivalente a <em>document.getElementsByTagName()</em>, pero mas potente pues devuelve un array con los elementos que cumplen la condición.</p><div class="syntax_hilite"><div id="javascript-39"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style="">$$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'div'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// Array de elementos Mootools</span></div></li><li style="color:#26536A;"><div style="">$$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'a.external'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// Array de enlaces con la class=external</span></div></li><li style="color:#3A6A8B;"><div style="">$$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'a[href=#]'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// Array de enlaces con href=# </span></div></li></ol></div></div></div><p></p><p><strong>Nuestro Primer Ejemplo</strong><br /> Una vez que tenemos los conceptos básicos, podemos implementar nuestro primer ejemplo, haremos que al cargar la página se aplique el estilo link a todos los enlaces de nuestro html, además pintamos de color rojo al div con nombre diverror, para ello tendríamos el siguiente código:</p><div class="syntax_hilite"><div id="html-40"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">window.addEvent('domready', function() {</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; $$('a').addClass('link');</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; $('diverror').setStyles('color: #CC0000');</div></li><li style="color:#3A6A8B;"><div style="">});</div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p><strong>Mas Información</strong><br /> Obviamente este es una pequeña introducción con los conceptos más básicos, mas adelante iremos desarrollando mas temas que nos ayudarán a comprender mas las capacidades de Mootools. Para mas información pueden les dejo una pequeña lista con recursos:</p><ul><li><a href="http://docs.mootools.net/">Mootools Docs</a></li><li><a href="http://demos.mootools.net/">Mootools Demos</a></li><li><a href="http://solutoire.com/2007/09/20/understanding-mootools-selectors-e-and-es/">Understanding Mootools Selectors $, $$, $E and $ES</a></li><li><a href="http://blog.mootools.net/2007/6/11/selectors-on-fire">Selectors on fire: a tale of pseudoselectors</a></li><li><a href="http://www.csslab.cl/2008/01/21/mootools-introduccin/">Mootools: introducción - CSSLab</a></li></ul><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/introduccion-a-mootools/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Introducción a AJAX</title><link>http://blog.unijimpe.net/introduccion-a-ajax/</link> <comments>http://blog.unijimpe.net/introduccion-a-ajax/#comments</comments> <pubDate>Wed, 26 Dec 2007 01:28:22 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[box.net]]></category> <category><![CDATA[click]]></category> <category><![CDATA[email]]></category> <category><![CDATA[eventos]]></category> <category><![CDATA[Internet Explorer]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[PNG]]></category><guid isPermaLink="false">http://blog.unijimpe.net/introduccion-a-ajax/</guid> <description><![CDATA[<p><strong>AJAX</strong> (<em>Asynchronous JavaScript And XML</em>) es una técnica de desarrollo web que permite comunicar el navegador del usuario con el servidor en segundo plano, es decir se pueden hacer cambios sobre la misma página &#8230;</p>]]></description> <content:encoded><![CDATA[<p><strong>AJAX</strong> (<em>Asynchronous JavaScript And XML</em>) es una técnica de desarrollo web que permite comunicar el navegador del usuario con el servidor en segundo plano, es decir se pueden hacer cambios sobre la misma página sin necesidad de recargarla.</p><p><strong>El Objeto XMLHttpRequest</strong><br /> XMLHttpRequest es el objeto primario que nos permitirá la comunicación con el servidor de forma asíncrona, originalmente fue implementada para <em>Internet Explorer</em> y basada en un <strong>ActiveX</strong> y ahora los otros navegadores también la soportan.</p><p>Entonces lo primero es detectar el tipo de navegador y crear una instancia del objeto XMLHttpRequest para poder utilizarlo posteriormente, para ello implementamos la siguiente función en <em>Javascript</em>.</p><div class="syntax_hilite"><div id="javascript-45"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style="">﻿<span style="color: #003366;">function</span> createXMLHttpRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> &nbsp; &nbsp;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #000066;">if</span> <span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">ActiveXObject</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> &nbsp; &nbsp;&nbsp;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">return</span> <span style="color: #003366;">new</span> ActiveXObject<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"Microsoft.XMLHTTP"</span><span style="color: #66cc66;">&#41;</span>; &nbsp;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> <span style="color: #000066;">else</span> <span style="color: #000066;">if</span> <span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">XMLHttpRequest</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> &nbsp; &nbsp;&nbsp;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">return</span> <span style="color: #003366;">new</span> XMLHttpRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; &nbsp; &nbsp;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span> &nbsp;&nbsp;</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #66cc66;">&#125;</span></div></li></ol></div></div></div><p></p><p><strong>Métodos y Propiedades</strong><br /> El objeto XMLHttpRequest dispone de los siguientes métodos:</p><ul><li><strong>send(content)</strong>: permite enviar datos al servidor.</li><li><strong>abort()</strong>: termina o cancela la petición actual.</li><li><strong>getAllResponseHeaders()</strong>: devuelve todos los headers de respuesta a la petición HTTP como pares <em>key/valor</em>.</li><li><strong>getResponseHeader("header")</strong>: devuelve una cadena con el valor del header especificado en <em>"header"</em>.</li><li><strong>open("method", "url")</strong>: permite realizar llamadas al servidor, el argumento del method puede ser GET, POST, o PUT.</li><li><strong>setRequestHeader("header", "value")</strong>: define un header especifico al valor dado por open().</li></ul><p>Además de ello las propiedades disponibles son las siguientes:</p><ul><li><strong>onreadystatechange</strong>: detector de eventos para ejecutar una función cada vez que se detecta el cambio en el estado de la petición.</li><li><strong>readyState</strong>: es el estado de la petición. Se tienes cinco estados posibles: 0 (<em>sin iniciar</em>), 1 (<em>cargando</em>), 2 (<em>cargado</em>), 3 (<em>interactuando</em>), 4 (<em>completo</em>)</li><li><strong>responseText</strong>: respuesta del servidor como un cadena de texto.</li><li><strong>responseXML</strong>: respuesta del servidor como un XML.</li><li><strong>status</strong>: código de estado HTTP del servidor (<em>200</em>, <em>404</em>, etc.)</li><li><strong>statusText</strong>: código de estado HTTP del servidor como texto (<em>OK</em>, <em>Not Found</em>, etc)</li></ul><p><strong>Ejemplo de Interacción</strong><br /> Sea que tenemos un campo de texto en donde un usuario ingresa su email, deseamos que nuestra página valide automáticamente si este email es correcto. Lo primero que hacemos es detectar que el usuario sale del campo de ingreso de email  y un boton para llamar a una función Javascript que se encarga de verificar el email.</p><div class="syntax_hilite"><div id="html-46"><div class="html"><ol><li style="color:#3A6A8B;"><div style="">Validar Email con AJAX: <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000;">&lt;br&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"email"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"email"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000;">&lt;br&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"button"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"bt"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"Send"</span> <span style="color: #000066;">onClick</span>=<span style="color: #ff0000;">"validMail();"</span><span style="color: #000000;">&gt;</span></a></span></div></li></ol></div></div></div><p></p><p>El siguiente paso es crear la función <strong>validMail</strong>, el cual tomará en email ingresado lo enviará a un script llamado <em>validate.php</em> que devolverá si es o no valido.</p><div class="syntax_hilite"><div id="javascript-47"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #003366;">var</span> xmlHttp;</div></li><li style="color:#26536A;"><div style=""><span style="color: #003366;">function</span> validMail<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #003366;">var</span> email = document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"email"</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; <span style="color: #003366;">var</span> url = <span style="color: #3366CC;">"validate.php?email="</span> + escape<span style="color: #66cc66;">&#40;</span>email.<span style="color: #006600;">value</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; xmlHttp = createXMLHttpRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; xmlHttp.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"GET"</span>, url<span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; xmlHttp.<span style="color: #006600;">onreadystatechange</span> = onCompleteData;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; xmlHttp.<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366;">null</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #66cc66;">&#125;</span></div></li><li style="color:#26536A;"><div style=""><span style="color: #003366;">function</span> onCompleteData<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #000066;">if</span> <span style="color: #66cc66;">&#40;</span>xmlHttp.<span style="color: #006600;">readyState</span> == <span style="color: #CC0000;color:#800000;">4</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>xmlHttp.<span style="color: #006600;">responseText</span><span style="color: #66cc66;">&#41;</span>;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div></li><li style="color:#26536A;"><div style=""><span style="color: #66cc66;">&#125;</span></div></li></ol></div></div></div><p> Como se puede observar, creamos una instancia del objeto <em>XMLHttpRequest</em> utilizando la función creada anteriormente, luego procedemos a llamar al PHP utilizando el método GET para enviar los datos, luego cuando se detecta el cambio en el estado de la petición ejecutaremos la función <em>onCompleteData</em>, la cual la definimos posteriormente y se encarga de lanzar un <strong>alert</strong> con la respuesta del servidor.</p><p>Uniendo todos el código obtenemos nuestro ejemplo de AJAX funcionando y sin utilizar ninguna librería externa para ello:</p><div class="syntax_hilite"><div id="html-48"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000;">&lt;html&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000;">&lt;head&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/title.html"><span style="color: #000000;">&lt;title&gt;</span></a></span>Ajax Demo&nbsp; - unijimpe<span style="color: #009900;"><span style="color: #000000;">&lt;/title&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">language</span>=<span style="color: #ff0000;">"JavaScript"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">function createXMLHttpRequest() { &nbsp;&nbsp;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; if (window.ActiveXObject) { &nbsp; &nbsp;&nbsp;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; return new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;); &nbsp;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; } else if (window.XMLHttpRequest) { &nbsp; &nbsp;&nbsp;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; return new XMLHttpRequest(); &nbsp; &nbsp;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; } &nbsp;&nbsp;</div></li><li style="color:#3A6A8B;"><div style="">}</div></li><li style="color:#26536A;"><div style="">var xmlHttp;</div></li><li style="color:#3A6A8B;"><div style="">function validMail() {</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; var email = document.getElementById(&quot;email&quot;);</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; var url = &quot;validate.php?email=&quot; + escape(email.value);</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; xmlHttp = createXMLHttpRequest();</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; xmlHttp.open(&quot;GET&quot;, url);</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; xmlHttp.onreadystatechange = onCompleteData;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; xmlHttp.send(null);</div></li><li style="color:#26536A;"><div style="">}</div></li><li style="color:#3A6A8B;"><div style="">function onCompleteData() {</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; if (xmlHttp.readyState == 4) {</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; &nbsp; &nbsp; alert(xmlHttp.responseText);</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; }</div></li><li style="color:#3A6A8B;"><div style="">}</div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/head&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000;">&lt;body&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">Validar Email con AJAX: <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000;">&lt;br&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"email"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"email"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000;">&lt;br&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"button"</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"bt"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"Send"</span> <span style="color: #000066;">onClick</span>=<span style="color: #ff0000;">"validMail();"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/body&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/html&gt;</span></span></div></li></ol></div></div></div><p></p><p>Pueden ver el ejemplo funcionando en <a href="http://samples.unijimpe.net/ajax/ajax-demo.html">ajax-demo.html</a> y como como siempre les dejamos los archivos fuente para que lo descarguen y hagan sus experimentos.</p><p style="text-align:center;"><a href="http://www.box.net/shared/ymto0tda8s"><img src="http://blog.unijimpe.net/btdown.png" border="0"></a></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/introduccion-a-ajax/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>EasyDrag jQuery Plugin</title><link>http://blog.unijimpe.net/easydrag-jquery-plugin/</link> <comments>http://blog.unijimpe.net/easydrag-jquery-plugin/#comments</comments> <pubDate>Wed, 10 Oct 2007 14:56:39 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[eventos]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://blog.unijimpe.net/easydrag-jquery-plugin/</guid> <description><![CDATA[<p><a href="http://fromvega.com/wordpress/2007/07/14/easydrag-jquery-plugin/">EasyDrag</a> es un plugin para la popular librería javascript <strong>jQuery</strong> el cual te permitirá añadir la funcionalidad de <em>Drag and drop</em> o <em>Arrastrar y soltar</em> a elementos html de tu pagina. Esta librería permite agregar la &#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://fromvega.com/wordpress/2007/07/14/easydrag-jquery-plugin/">EasyDrag</a> es un plugin para la popular librería javascript <strong>jQuery</strong> el cual te permitirá añadir la funcionalidad de <em>Drag and drop</em> o <em>Arrastrar y soltar</em> a elementos html de tu pagina. Esta librería permite agregar la funcionalidad de drag con sencillas lineas de código, además de ello tiene detectores de eventos con lo cual se pueden controlar los drag dependiendo de las acciones realizadas.</p><p><strong>Utilización</strong><br /> Lo primero para utilizar EasyDrag es descargar <strong>JQuery</strong> y luego <a href="http://fromvega.com/code/easydrag/jquery.easydrag.js">jquery.easydrag.js</a>, este ultimo archivo contienen las funciones necesarias para el funcionamiento de esta librería.</p><p>El siguiente paso es añadir estas librerías al header de nuestro html, para ello utilizamos los tags script para incluirlas de la forma:</p><div class="syntax_hilite"><div id="html-53"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"jquery.js"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"jquery.easydrag.js"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p> Luego el siguiente paso es agregar la función easydrag al elemento que deseamos controlar de la siguiente forma:</p><div class="syntax_hilite"><div id="html-54"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">$(function(){</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; $(&quot;#box1&quot;).easydrag();</div></li><li style="color:#26536A;"><div style="">});</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Uniendo estas lineas tendremos el siguiente código con el cual podemos hacer <em>Drag</em> a un elemento html.</p><div class="syntax_hilite"><div id="html-55"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000;">&lt;html&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000;">&lt;head&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/title.html"><span style="color: #000000;">&lt;title&gt;</span></a></span>EasyDrag Demo<span style="color: #009900;"><span style="color: #000000;">&lt;/title&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"jquery.js"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"jquery.easydrag.js"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">$(function(){</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; $(&quot;#box1&quot;).easydrag();</div></li><li style="color:#3A6A8B;"><div style="">});</div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/style.html"><span style="color: #000000;">&lt;style</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/css"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">#box1 {</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; font-family: &quot;Trebuchet MS&quot;, Tahoma, Verdana;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; background-color: yellow;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; padding: 5px;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; border: 2px solid orange;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; width: 200px;</div></li><li style="color:#26536A;"><div style="">}</div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/style&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/head&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000;">&lt;body&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000;">&lt;h3&gt;</span></a></span>EasyDrag jQuery Plugin <span style="color: #009900;"><span style="color: #000000;">&lt;/h3&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"box1"</span><span style="color: #000000;">&gt;</span></a></span>Versi<span style="color: #ddbb00;">&amp;oacute;</span>n demo de Easy Drag<span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/body&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/html&gt;</span></span></div></li></ol></div></div></div><p></p><p>También existe la posibilidad de detectar cuando se termina de hacer el drag, para ello se utiliza el evento <em>ondrop</em>, con el cual se pude llamar a una acción de la siguiente forma:</p><div class="syntax_hilite"><div id="html-56"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000;">&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">$(function(){</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; $(&quot;#box1&quot;).easydrag();</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp; $(&quot;#box1&quot;).ondrop(function(){ alert(&quot;Dropped&quot;); });</div></li><li style="color:#3A6A8B;"><div style="">});</div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li></ol></div></div></div><p></p><p>Como pueden ver es una forma muy sencilla de crear este tipo de efectos para nuestras páginas html. Les dejo el ejemplo funcionando en: <a href="http://samples.unijimpe.net/easydrag.html">http://samples.unijimpe.net/easydrag.html</a></p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/easydrag-jquery-plugin/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>JQuery UI</title><link>http://blog.unijimpe.net/jquery-ui/</link> <comments>http://blog.unijimpe.net/jquery-ui/#comments</comments> <pubDate>Tue, 18 Sep 2007 15:15:34 +0000</pubDate> <dc:creator>unijimpe</dc:creator> <category><![CDATA[AJAX]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Javascript]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[Google]]></category> <category><![CDATA[ZIP]]></category><guid isPermaLink="false">http://blog.unijimpe.net/jquery-ui/</guid> <description><![CDATA[<p><a href="http://ui.jquery.com/">jQuery UI</a> es un conjunto de widget o aplicaciones pequeñas que permiten personalización e interactividad, desarrolladas utilizando JQuery se pueden utilizar para desarrollas aplicaciones altamente interactivas y de gran calidad.</p><p style="text-align:center;"><a href="http://ui.jquery.com/"></a></p><p>El corazón de esta librería contiene &#8230;</p>]]></description> <content:encoded><![CDATA[<p><a href="http://ui.jquery.com/">jQuery UI</a> es un conjunto de widget o aplicaciones pequeñas que permiten personalización e interactividad, desarrolladas utilizando JQuery se pueden utilizar para desarrollas aplicaciones altamente interactivas y de gran calidad.</p><p style="text-align:center;"><a href="http://ui.jquery.com/"><img id="image633" src="http://blog.unijimpe.net/wp-content/uploads/2007/09/jquery-ui.gif" alt="jquery-ui.gif" /></a></p><p>El corazón de esta librería contiene funciones para diferentes interacciones con el mouse, arrastrar y soltar, ordenamiento, selecciones y redimensión de elementos. Basado en estas funciones se implementan <em>widgets</em> como: acordeon, selectores de fechas, pantallas de dialogo, sliders, ordenamiento de tablas y tabs.</p><p>Puedes ver los ejemplos en la web oficial y se encontrarán con una amplia variedad de formas de utilizar esta librería.</p><p style="text-align:center;"><img id="image635" src="http://blog.unijimpe.net/wp-content/uploads/2007/09/jquery-ui-samples.gif" alt="jquery-ui-samples.gif" /></p><p><strong>Descargar jQuery UI</strong><br /> Esta librería necesita JQuery para su funcionamiento, para descargarlo puedes hacerlo desde: <a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery.ui-1.0.zip">jquery.ui-1.0.zip</a> con un tamaño de 101Kb es muy ligero comparado con lo que se puede lograr. Además existe la posibilidad de seleccionar los elementos y/o temas que se desean descargar.</p><p><strong>Ejemplo</strong><br /> Veamos un ejemplo muy sencillo, crearemos un elemento html y lo convertiremos en arrastrable o draggable, para ello empleamos la propiedad <strong>draggable</strong>, donde se le define que elemento sera el que se puede arrastrar.</p><div class="syntax_hilite"><div id="javascript-59"><div class="javascript"><ol><li style="color:#3A6A8B;"><div style="">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">".block"</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">draggable</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div></li></ol></div></div></div><p></p><p>Entonces implementando el HTML para verlo funcionar se tendría:</p><div class="syntax_hilite"><div id="html-60"><div class="html"><ol><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000;">&lt;html&gt;</span></a></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000;">&lt;head&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/jquery.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/ui.mouse.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/ui.draggable.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script</span></a> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"js/ui.draggable.ext.js"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style="">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000;">&lt;script&gt;</span></a></span></div></li><li style="color:#26536A;"><div style="">&nbsp; $(document).ready(function(){</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp; $(&quot;.block&quot;).draggable();</div></li><li style="color:#26536A;"><div style="">&nbsp; });</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; <span style="color: #009900;"><span style="color: #000000;">&lt;/script&gt;</span></span></div></li><li style="color:#26536A;"><div style="">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/style.html"><span style="color: #000000;">&lt;style&gt;</span></a></span>.block {</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp;border: 2px solid #0090DF;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp;background-color: #68BFEF;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp;width: 150px;</div></li><li style="color:#26536A;"><div style="">&nbsp; &nbsp;height: 70px;</div></li><li style="color:#3A6A8B;"><div style="">&nbsp; &nbsp;margin: 10px;</div></li><li style="color:#26536A;"><div style="">}<span style="color: #009900;"><span style="color: #000000;">&lt;/style&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/head&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000;">&lt;body&gt;</span></a></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000;">&lt;div</span></a> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"block"</span><span style="color: #000000;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000;">&lt;/div&gt;</span></span></div></li><li style="color:#26536A;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/body&gt;</span></span></div></li><li style="color:#3A6A8B;"><div style=""><span style="color: #009900;"><span style="color: #000000;">&lt;/html&gt;</span></span></div></li></ol></div></div></div><p></p><p>El resultado del ejemplo lo pueden ver en <a href="http://samples.unijimpe.net/jquery-ui.htm">jquery-ui.htm</a>, como ven sencillo y con un resultado de buena calidad. Para muchos desarrolladores esta librería contribuirá a lograr mejores interfaces en el desarrollo de nuestras aplicaciones.</p><p style="font-size: 10px;border-top: 1px solid #666666;margin-top=12px;padding-top:6px;">&copy; 2006 - 2011 <a href="http://blog.unijimpe.net">unijimpe</a> - Utiliza este feed solo para uso personal, partes de este feed pueden ser utilizados mencionando al autor, no esta permitido publicar enteramente este feed para uso comercial sin permiso del autor.</p><br /> ]]></content:encoded> <wfw:commentRss>http://blog.unijimpe.net/jquery-ui/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching using disk: basic

Served from: blog.unijimpe.net @ 2012-02-08 10:00:13 -->
