<?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>yosoygil &#124; portafolio &#187; Web</title>
	<atom:link href="http://yosoygil.com/tag/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://yosoygil.com</link>
	<description></description>
	<lastBuildDate>Fri, 18 May 2012 18:02:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Fancybox para desplegar un PopUp en onLoad</title>
		<link>http://yosoygil.com/2011/06/fancybox-para-desplegar-un-popup-en-onload/</link>
		<comments>http://yosoygil.com/2011/06/fancybox-para-desplegar-un-popup-en-onload/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 17:23:05 +0000</pubDate>
		<dc:creator>gil!</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://yosoygil.com/?p=146</guid>
		<description><![CDATA[Hace unas cuantas semanas me pidieron que al entrar a un sitio cargara un popup ...]]></description>
			<content:encoded><![CDATA[<p>Hace unas cuantas semanas me pidieron que al entrar a un sitio cargara un popup con una publicación, dije un popup? Ni que estuviéramos en 1998, ese pedo ya no se usa, pero bueno, insistieron y lo único no tan intrusivo que se me ocurrió fue hacerlo en una ventana modal de <a href="http://fancybox.net/" target="_blank">Fancybox</a>, así me que puse a investigar hasta que di con este sitio, <a href="http://zunskigraphics.com/zblog/archives/153" target="_blank">Using Fancybox for a PopUp</a>.</p>
<p>El famoso Fancybox, por si no lo conocen, es una utilería hecha con jQuery en la que puedes presentar fotos, texto, código html, ajax, video y cosas así.</p>
<p>En el articulo viene muy bien explicado como instalarlo y hacer el PopUp para que cargue una imagen, en mi caso me pidieron que lo que cargara fuera un video de youtube, les dejaré como hacerlo.</p>
<p>1.- Sigues las instrucciones de <a href="http://fancybox.net/howto" target="_blank">este link</a> para instalar el Fancybox.</p>
<p>2.-  Inserta el siguiente código dentro de el <em>head</em> de tu archivo.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
  $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">ready</span><span style="color: #009900;">&#40;</span>function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	  $<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#yt&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">click</span><span style="color: #009900;">&#40;</span>function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$.<span style="color: #006633;">fancybox</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
		  <span style="color: #0000ff;">'padding'</span>        <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span>,
		  <span style="color: #0000ff;">'autoScale'</span>      <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">false</span>,
		  <span style="color: #0000ff;">'transitionIn'</span>   <span style="color: #339933;">:</span> <span style="color: #0000ff;">'none'</span>,
		  <span style="color: #0000ff;">'transitionOut'</span>  <span style="color: #339933;">:</span> <span style="color: #0000ff;">'none'</span>,
		  <span style="color: #0000ff;">'title'</span>          <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">title</span>,
		  <span style="color: #0000ff;">'width'</span>          <span style="color: #339933;">:</span> <span style="color: #cc66cc;">680</span>,
		  <span style="color: #0000ff;">'height'</span>         <span style="color: #339933;">:</span> <span style="color: #cc66cc;">495</span>,
		  <span style="color: #0000ff;">'href'</span>           <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">href</span>.<span style="color: #006633;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> RegExp<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;watch<span style="color: #000099; font-weight: bold;">\\</span>?v=&quot;</span>, <span style="color: #0000ff;">&quot;i&quot;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">'v/'</span><span style="color: #009900;">&#41;</span>,
		  <span style="color: #0000ff;">'type'</span>           <span style="color: #339933;">:</span> <span style="color: #0000ff;">'swf'</span>,
		  <span style="color: #0000ff;">'swf'</span>            <span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
		  <span style="color: #0000ff;">'wmode'</span>              <span style="color: #339933;">:</span> <span style="color: #0000ff;">'transparent'</span>,
		  <span style="color: #0000ff;">'allowfullscreen'</span>    <span style="color: #339933;">:</span> <span style="color: #0000ff;">'true'</span>
		  <span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>3.- Inserta el siguiente código en cualquier parte dentro del <em>body</em>, por orden es preferible ponerlo justo después de abrir el <em>body</em> o justo antes de cerrarlo.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;display: none;&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;yt&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.youtube.com/watch?v=IDDELVIDEO&amp;amp;fs=1&amp;amp;autoplay=1&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></td></tr></table></div>

<p><small>* Nótese que el <em>div</em> que abrimos está escondido, esto para que no se vea en ningún lugar del sitio.</small><br />
<small>* Si no quieres que empiece solo, nada mas hay que cambiar de 1 a 0 en <em>autoplay</em>.</small></p>
<p>4.- Y por último mandamos llamar el PopUp en el onLoad de nuestro <em>body</em> como en el siguiente ejemplo.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">onload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">'$(&quot;#yt&quot;).trigger(&quot;click&quot;);'</span>&gt;</span></pre></td></tr></table></div>

<p>Bueno, ya quedó.</p>
]]></content:encoded>
			<wfw:commentRss>http://yosoygil.com/2011/06/fancybox-para-desplegar-un-popup-en-onload/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

