<?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>Ramon Victor &#187; javascript</title>
	<atom:link href="http://www.ramonvictor.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ramonvictor.com</link>
	<description></description>
	<lastBuildDate>Fri, 09 Sep 2011 14:59:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Efeitos de animação em menus com jQuery</title>
		<link>http://www.ramonvictor.com/efeitos-de-animacao-em-menus-com-jquery/</link>
		<comments>http://www.ramonvictor.com/efeitos-de-animacao-em-menus-com-jquery/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 18:26:25 +0000</pubDate>
		<dc:creator>ramonvictor</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Animação]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ramonvictor.com/?p=307</guid>
		<description><![CDATA[O jQuery trouxe aos desenvolvedores diversas facilidades na hora de implementar interações client-side. Uma delas é a opção de criar animações, com uma simples função animate conseguimos obter belos efeitos visuais. Diria até que essa função é a melhor maneira &#8230; <a href="http://www.ramonvictor.com/efeitos-de-animacao-em-menus-com-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>O jQuery trouxe aos desenvolvedores diversas facilidades na hora de implementar interações client-side. Uma delas é a opção de criar animações, com uma simples função <strong>animate </strong>conseguimos obter belos efeitos visuais.<br />
<span id="more-307"></span><br />
Diria até que essa função é a melhor maneira de substituir o flash (pelo menos em menus). Pois menus em flash quebram o conceito de acessibilidade de qualquer site. O jquery acaba sendo a melhor opção de obter efeitos animados legais sem comprometer a acessibilidade.</p>
<p>Veja o <a href="http://www.ramonvictor.com/demo/animacao_menu/">demo</a>.</p>
<p>Sem muita conversa vamos ver como implementar três efeitos de animação em menus.</p>
<h3>Animação 1</h3>
<p>Essa é um efeito simples q movimenta o texto com a propriedade text-indent.</p>
<p><strong>XHTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;ul id=&quot;animation-1&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Inicio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contato&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">#animation-1 li{
  width: 200px;
}
#animation-1 li a {
  display: block;
  padding:  10px 5px;
  width:190px;
  background-color: #ccc
}</pre>
<p><strong>jQuery</strong></p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function(){
  $(&quot;#animation-1 li a&quot;).hover(
    function(){
      $(this).animate({ textIndent: &quot;30px&quot; }, 500 );
    },function(){
      $(this).animate({ textIndent: &quot;0px&quot; }, 500 );
  });
});
</pre>
<h3>Animação 2</h3>
<p>Nesse exemplo vamos aumentar a largura do link selecionado e adicionar uma classe <strong>.off</strong> para para os demais links.</p>
<p><strong>XHTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;ul id=&quot;animation-2&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Inicio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contato&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">#animation-2 li a {
  display: block;
  padding:  10px 5px;
  width: 200px;
  background-color: #ccc
}
#animation-2 .off a{
  background-color: #e1e1e1
}</pre>
<p><strong>jQuery</strong></p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function(){
  $(&quot;#animation-2 li a&quot;).hover(function(){
     $(this).parent().parent().find(&quot;li&quot;).addClass(&quot;off&quot;);
     $(this).parent().removeClass(&quot;off&quot;);
     $(this).animate({ width: &quot;250px&quot; }, 500 );
  },function(){
     $(this).parent().parent().find(&quot;li&quot;).removeClass(&quot;off&quot;);
     $(this).animate({ width: &quot;200px&quot; }, 500 );
  });
});
</pre>
<h3>Animação 3</h3>
<p>Esse efeito é muito utilizado em flash. Em nosso caso conseguimos um efeito bem semelhante com apenas um &lt;span&gt; animado.</p>
<p><strong>XHTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;ul id=&quot;animation-3&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Inicio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contato&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">#animation-3 {
width: 200px
}
#animation-3 li{
  border: 1px solid #e1e1e1;
  height: 32px;
  overflow: hidden;
  position: relative;
}
#animation-3 li a{
  display: block;
  padding:  7px 5px;
  color: #6F6F6F
}
#animation-3 li span {
  display: block;
  height: 35px;
  width: 200px;
  background-color: #e1e1e1;
  position: absolute;
  top: 35px;
  left: 0;
  z-index: -1
}</pre>
<p><strong>jQuery</strong></p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function(){
  $(&quot;#animation-3 li&quot;).append(&quot;&lt;span&gt;&lt;/span&gt;&quot;);
  $(&quot;#animation-3 li a&quot;).hover(
    function(){
      $(this).next(&quot;span&quot;).animate({ top: &quot;0px&quot; }, 500 );
    },function(){
      $(this).next(&quot;span&quot;).animate({ top: &quot;45px&quot; }, 500 );
    });
});
</pre>
<p>Não esqueçam de adicionar os scripts abaixo do link para a biblioteca:</p>
<pre class="brush: xml; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;</pre>
<p>Obs.: foi testado no FireFox 3+, Internet Explorer 6+, Chrome, Opera e Safari.</p>
<p>Faça o <a href="http://www.ramonvictor.com/demo/animacao_menu/animacao_menu.zip">download</a> e ajuste às suas necessidades.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramonvictor.com/efeitos-de-animacao-em-menus-com-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Plugin jQuery Font Size 1.1</title>
		<link>http://www.ramonvictor.com/plugin-jquery-font-size-1-1/</link>
		<comments>http://www.ramonvictor.com/plugin-jquery-font-size-1-1/#comments</comments>
		<pubDate>Sun, 06 Sep 2009 18:13:35 +0000</pubDate>
		<dc:creator>ramonvictor</dc:creator>
				<category><![CDATA[Acessibilidade]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.ramonvictor.com/?p=285</guid>
		<description><![CDATA[Depois de publicar a primeira versão do plugin recebi várias sugestões de melhoria e acabei detectando também algumas funcionalidades que poderiam ser acrescentadas. Inicialmente só poderíamos utilizar 4 opções (alvo, tipoPaiLink, setCookie e variacoes) com a atualização ganhamos mais uma &#8230; <a href="http://www.ramonvictor.com/plugin-jquery-font-size-1-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Depois de publicar a <a href="http://www.ramonvictor.com/plugin-font-size-jquery/">primeira versão do plugin</a> recebi várias sugestões de melhoria e acabei detectando também algumas funcionalidades que poderiam ser acrescentadas.<span id="more-285"></span> Inicialmente só poderíamos utilizar 4 opções (<strong>alvo</strong>, <strong>tipoPaiLink</strong>, <strong>setCookie</strong> e <strong>variacoes</strong>) com a atualização ganhamos mais uma nova, <strong>opResetar</strong>, que iremos entender mais a frente sua função.</p>
<p><a href="http://www.ramonvictor.com/demo/fontsize/">Demo da versão 1.0</a><br />
<a href="http://www.ramonvictor.com/demo/fontsize/fontsize1.1/">Demo da versão 1.1</a></p>
<h3>O que há de novo?</h3>
<ul>
<li>
<h4>1. Opção de criar botão para restaurar o tamanho original.</h4>
<p>Essa opção foi solicitada por pessoas que estão utilizando o plugin. E para implementá-la é bastante simples, só precisamos declarar o novo parâmetro da seguinte maneira:</p>
<pre class="brush: jscript; title: ; notranslate">opResetar: true</pre>
<p>Perceba no <a href="http://www.ramonvictor.com/demo/fontsize/fontsize1.1/">demo</a> que foi acrescentado um novo link, entre o que aumenta e diminui, que tem a função de resetar a fonte para o seu tamanho inicial.</li>
<li>
<h4>2. Inserir os links manualmente</h4>
<p>Antes só era possível inserir os links de controle pelo plugin, declarando o <strong>tipoPaiLink</strong> como &#8216;ul&#8217; ou &#8216;p&#8217;. Agora o desenvolvedor tem a opção de inserir manualmente o seu código XHTML  para dar maior flexibilidade na customização. Observe o exemplo abaixo.</p>
<p><strong>XHTML</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;ul&gt;
  &lt;li&gt;tamanho da fonte:&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;javascript:;&quot; class=&quot;menos&quot; title=&quot;Diminuir tamanho da letra&quot;&gt;A-&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;javascript:;&quot; class=&quot;resetar&quot; title=&quot;Tamanho padr&amp;atilde;o&quot;&gt;A&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;javascript:;&quot; class=&quot;mais&quot; title=&quot;Aumentar tamanho da letra&quot;&gt;A+&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>Perceba que é preciso manter o nome das classes que controlam o tamanho: <strong>menos</strong>, <strong>resetar </strong>e <strong>mais</strong>.</p>
<p>Na chamada da função teremos que modificar algumas coisas: iremos deixar o parâmetro principal vazio (já que não vamos inserir via DOM os links); não devemos declarar mais o <strong>tipoPaiLink</strong> e <strong>opResetar</strong>. Vejo o exemplo:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
  $().fontSize({
     alvo: '#content',
     setCookie: true
  });
});</pre>
</li>
<li>
<h4>3. Classe &#8220;desabilitar&#8221; para quando o link chegar ao limite</h4>
<p>Nessa nova opção você precisa configurar apenas o CSS dando estilo a classe <strong>desabilitar</strong>, que será adicionada no link quando ele não estiver mais mudando o tamanho do texto.</p>
<p><strong>CSS</strong></p>
<pre class="brush: css; title: ; notranslate">#font_size li .disabilitar {
  color: #AFAFAF;
  background-color: #DFDFDF
}</pre>
</li>
</ul>
<h3>Resumidamente temos duas opções:</h3>
<p><strong>Inserir manualmente os links de controle.</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;cookie.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;font_size.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
  $().fontSize({
    alvo: '#content',
    setCookie: true
  });
});
&lt;/script&gt;</pre>
<p>XHTML</p>
<pre class="brush: xml; title: ; notranslate">&lt;ul&gt;
  &lt;li&gt;tamanho da fonte:&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;javascript:;&quot; class=&quot;menos&quot; title=&quot;Diminuir tamanho da letra&quot;&gt;A-&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;javascript:;&quot; class=&quot;resetar&quot; title=&quot;Tamanho padr&amp;atilde;o&quot;&gt;A&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;javascript:;&quot; class=&quot;mais&quot; title=&quot;Aumentar tamanho da letra&quot;&gt;A+&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p><strong>Ou deixar o script fazer tudo sozinho.</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;cookie.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;font_size.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
  $('#font_size').fontSize({
    alvo: '#content',
    setCookie: true,
    opResetar: true,
    tipoPaiLink: 'ul'
  });
});
&lt;/script&gt;</pre>
<p>XHTML</p>
<pre class="brush: xml; title: ; notranslate">&lt;div id=&quot;font_size&quot;&gt;&lt;/div&gt;</pre>
<p>Faça o <a href="http://www.ramonvictor.com/demo/fontsize/fontsize1.1/font_size1.1.zip">download do Plugin Font Size 1.1</a> ou leia o <a href="http://www.ramonvictor.com/plugin-font-size-jquery/">post da primeira versão</a> para entender melhor o funcionamento.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ramonvictor.com/plugin-jquery-font-size-1-1/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

