<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[A.PAO designSTUDIO BLOG]]></title> 
<link>https://blog.apao.idv.tw/index.php</link> 
<description><![CDATA[A.PAO designSTUDIO 阿保工作室]]></description> 
<language>zh-tw</language> 
<copyright><![CDATA[A.PAO designSTUDIO BLOG]]></copyright>
<item>
<link>https://blog.apao.idv.tw/post//</link>
<title><![CDATA[清單中背景出現動畫 jQuery Background Position]]></title> 
<author>apao &lt;apao@www.apao.idv.tw&gt;</author>
<category><![CDATA[jQuery]]></category>
<pubDate>Wed, 01 Feb 2012 03:44:35 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post//</guid> 
<description>
<![CDATA[ 
	<a href="https://blog.apao.idv.tw/attachment.php?fid=1372" target="_blank"><img src="https://blog.apao.idv.tw/attachment.php?fid=1372" class="insertimage" alt="點擊在新視窗中瀏覽此圖片" title="點擊在新視窗中瀏覽此圖片" border="0"/></a><br/><br/><div class="code">&lt;style&gt;&nbsp;&nbsp;<br/>ul &#123;list-style:none;margin:0;padding:0;&#125;<br/>li &#123;float:left;width:100px;line-height:25px;height:25px;margin:0;padding:0;text-align:center;&#125;<br/>li a &#123;background:url(背景圖片) repeat 0 0;display:block;padding:5px 10px;color:#FFF;text-decoration:none;border-right:1px solid #FFF;&#125;<br/>&lt;/style&gt;<br/>&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.js&quot;&gt;&lt;/script&gt;<br/>&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.bgpos.js&quot;&gt;&lt;/script&gt;<br/>&lt;script type=&quot;text/javascript&quot;&gt;<br/>$(document).ready(function() &#123;<br/>&nbsp;&nbsp;$(&#039;li a&#039;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;.css( &#123;backgroundPosition: &quot;-20px 35px&quot;&#125; ) //デフォルト時、背景画像を横-20px、縦35pxに指定。<br/>&nbsp;&nbsp;&nbsp;&nbsp;.mouseover(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).stop().animate(&#123;backgroundPosition:&quot;(-20px 94px)&quot;&#125;, &#123;duration:500&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//マウスオーバー時に縦位置94pxに0.5秒かけて移動<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;.mouseout(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).stop().animate(&#123;backgroundPosition:&quot;(40px 35px)&quot;&#125;, &#123;duration:200, complete:function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//マウスアウト時に横位置40px、縦位置35pxに2秒かけて移動<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).css(&#123;backgroundPosition: &quot;-20px 35px&quot;&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//移動完了後、元の位置に戻す<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;&#125;)<br/>&nbsp;&nbsp;&#125;)<br/>&#125;);<br/>&lt;/script&gt;</div><br/><br/>html中放置<br/><div class="code">&lt;ul id=&quot;demo&quot;&gt;<br/>&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Home&lt;/a&gt;&lt;/li&gt;<br/>&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;#&quot;&gt;About&lt;/a&gt;&lt;/li&gt;<br/>&nbsp;&nbsp;&lt;li&gt;&lt;a href=&quot;#&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;<br/></div></ul><br/><br/>備註：詳細可參考demo中CSS ID+Script的作法，可分好幾種動畫。<br/><br/><div class="code">&nbsp;&nbsp;$(&#039;#a a&#039;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;.css( &#123;backgroundPosition: &quot;-20px 35px&quot;&#125; )<br/>&nbsp;&nbsp;&nbsp;&nbsp;.mouseover(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).stop().animate(&#123;backgroundPosition:&quot;(-20px 94px)&quot;&#125;, &#123;duration:500&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;.mouseout(function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).stop().animate(&#123;backgroundPosition:&quot;(40px 35px)&quot;&#125;, &#123;duration:200, complete:function()&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$(this).css(&#123;backgroundPosition: &quot;-20px 35px&quot;&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;&#125;)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;)</div><br/><br/>出處：<br/><a href="http://snook.ca/technical/jquery-bg/" target="_blank">http://snook.ca/technical/jquery-bg/</a><br/><br/>參考:<br/><a href="http://www.skuare.net/test/jBgpos.html" target="_blank">http://www.skuare.net/test/jBgpos.html</a><br/><br/>demo:<br/><a href="http://apao.zapto.org/~apao/jQuery/Background_Position/" target="_blank">http://apao.zapto.org/~apao/jQuery/Background_Position/</a><br/><br/>Tags - <a href="https://blog.apao.idv.tw/tags/jquery/" rel="tag">jquery</a> , <a href="https://blog.apao.idv.tw/tags/background/" rel="tag">background</a> , <a href="https://blog.apao.idv.tw/tags/position/" rel="tag">position</a> , <a href="https://blog.apao.idv.tw/tags/%25E6%25B8%2585%25E5%2596%25AE/" rel="tag">清單</a> , <a href="https://blog.apao.idv.tw/tags/%25E8%2583%258C%25E6%2599%25AF/" rel="tag">背景</a> , <a href="https://blog.apao.idv.tw/tags/%25E5%258B%2595%25E7%2595%25AB/" rel="tag">動畫</a>
]]>
</description>
</item><item>
<link>https://blog.apao.idv.tw/post//#blogcomment</link>
<title><![CDATA[[評論] 清單中背景出現動畫 jQuery Background Position]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[評論]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://blog.apao.idv.tw/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>