<?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>Modern Fun － 摩登坊 &#187; 前端技术</title>
	<atom:link href="http://www.steveluo.name/category/knowledge-base/%e5%89%8d%e7%ab%af%e6%8a%80%e6%9c%af/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.steveluo.name</link>
	<description>Modernize our life!</description>
	<lastBuildDate>Wed, 21 Jul 2010 12:55:34 +0000</lastBuildDate>
	<language>zh-cn</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>jQuery中使用mouseleave代替mouseout</title>
		<link>http://www.steveluo.name/jquery-mouseleave-instead-of-mouseout/</link>
		<comments>http://www.steveluo.name/jquery-mouseleave-instead-of-mouseout/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 10:09:08 +0000</pubDate>
		<dc:creator>Steve Luo</dc:creator>
				<category><![CDATA[前端技术]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[前端]]></category>
		<category><![CDATA[网站]]></category>

		<guid isPermaLink="false">http://www.steveluo.name/?p=214</guid>
		<description><![CDATA[今天在写一个鼠标悬停下拉菜单过程中，遇到一个很抓狂的问题。既然是鼠标悬停效果，那就用到了jQuery的2个事件，mouseover和mouseout（在jQuery 1.3的API手册中只有这两个鼠标移入移出事件）。 先看下使用mouseout的效果： &#60;script type=&#34;text/javascript&#34; src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&#34;&#62;&#60;/script&#62; &#60;div id=&#34;container&#34; style=&#34;width:300px;&#34;&#62; &#60;div id=&#34;title&#34; style=&#34;cursor:pointer; background:#ccc;&#34;&#62;使用了mouseout事件↓&#60;/div&#62; &#60;div id=&#34;list&#34; style=&#34;display:none;position:absolute; border:1px solid #ccc; width:300px;&#34;&#62; &#60;div&#62;第一行&#60;/div&#62; &#60;div&#62;第二行&#60;/div&#62; &#60;div&#62;第三行&#60;/div&#62; &#60;/div&#62; &#60;/div&#62; &#60;script type=&#34;text/javascript&#34;&#62; $(function(){ // 绑定鼠标移入标题时，显示下拉容器 var list = $(&#34;#list&#34;); $(&#34;#title&#34;).mouseover(function() { var offset = $(this).offset(); list.css(&#34;left&#34;, offset.left); list.css(&#34;top&#34;, offset.top+19); list.show(); }); // 绑定mouseout事件，无法实现我们的预期效果 $(&#34;#container&#34;).mouseout(function() { $(&#34;#list&#34;).hide(); }); }); &#60;/script&#62; Tips:您可以在运行代码前对其进行修改！ [...]]]></description>
			<content:encoded><![CDATA[<p>今天在写一个鼠标悬停下拉菜单过程中，遇到一个很抓狂的问题。既然是鼠标悬停效果，那就用到了jQuery的2个事件，mouseover和mouseout（在jQuery 1.3的API手册中只有这两个鼠标移入移出事件）。</p>
<p>先看下使用mouseout的效果：</p>
<div class="runcode">
<p><textarea name="runcode" style="height:300px;width:600px;font-size:12px" class="runcode_text" id="runcode_IdCf1N">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;div id=&quot;container&quot; style=&quot;width:300px;&quot;&gt;
    &lt;div id=&quot;title&quot; style=&quot;cursor:pointer; background:#ccc;&quot;&gt;使用了mouseout事件↓&lt;/div&gt;
    &lt;div id=&quot;list&quot; style=&quot;display:none;position:absolute; border:1px solid #ccc; width:300px;&quot;&gt;
        &lt;div&gt;第一行&lt;/div&gt;
        &lt;div&gt;第二行&lt;/div&gt;
        &lt;div&gt;第三行&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
    // 绑定鼠标移入标题时，显示下拉容器
    var list = $(&quot;#list&quot;);
    $(&quot;#title&quot;).mouseover(function() {
        var offset = $(this).offset();
        list.css(&quot;left&quot;, offset.left);
        list.css(&quot;top&quot;, offset.top+19);
        list.show();
    });
    // 绑定mouseout事件，无法实现我们的预期效果
    $(&quot;#container&quot;).mouseout(function() {
        $(&quot;#list&quot;).hide();
    });
});
&lt;/script&gt;
</textarea></p>
<p><input type="button" value="运行代码" class="runcode_button" onclick="runcode_open_new('runcode_IdCf1N');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_IdCf1N');"/> <input type="button" value="另存为" class="runcode_button" onclick="saveCode('runcode_IdCf1N','runcode_IdCf1N');"/> Tips:您可以在运行代码前对其进行修改！</p>
</div>
<p>我们发现使用mouseout时，鼠标只要在容器里一移动，就被出发了hide()，其实是因为mouseout事件也会影响到子元素，也就是事件可能被同时绑定到了该容器的子元素上，所以鼠标移出每个子元素也都会触发我们的hide()。<br />
<span id="more-214"></span><br />
经过网上一番调研~从jQuery 1.3开始新增了2个mouse事件，mouseenter和mouseleave。现在我们使用mouseleave事件，这个事件在jQuery手册上好像并没有提到&#8230;囧<br />
我们来看一下mouseleave事件是否能够解决这个问题。</p>
<div class="runcode">
<p><textarea name="runcode" style="height:300px;width:600px;font-size:12px" class="runcode_text" id="runcode_P2j6Uo">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;div id=&quot;container&quot; style=&quot;width:300px;&quot;&gt;
    &lt;div id=&quot;title&quot; style=&quot;cursor:pointer; background:#ccc;&quot;&gt;使用了mouseleave事件↓&lt;/div&gt;
    &lt;div id=&quot;list&quot; style=&quot;display:none;position:absolute; border:1px solid #ccc; width:300px;&quot;&gt;
        &lt;div&gt;第一行&lt;/div&gt;
        &lt;div&gt;第二行&lt;/div&gt;
        &lt;div&gt;第三行&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
    // 绑定鼠标移入标题时，显示下拉容器
    var list = $(&quot;#list&quot;);
    $(&quot;#title&quot;).mouseover(function() {
        var offset = $(this).offset();
        list.css(&quot;left&quot;, offset.left);
        list.css(&quot;top&quot;, offset.top+19);
        list.show();
    });
    // 绑定mouseleave事件，效果很好
    $(&quot;#container&quot;).mouseleave(function() {
        $(&quot;#list&quot;).hide();
    });
});
&lt;/script&gt;
</textarea></p>
<p><input type="button" value="运行代码" class="runcode_button" onclick="runcode_open_new('runcode_P2j6Uo');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_P2j6Uo');"/> <input type="button" value="另存为" class="runcode_button" onclick="saveCode('runcode_P2j6Uo','runcode_P2j6Uo');"/> Tips:您可以在运行代码前对其进行修改！</p>
</div>
<p>好了，我们的问题解决了，需要的朋友各取所需吧。</p>
<p>本文参考了<a href="http://amcucn.javaeye.com/blog/473251" target="_blank">jquery中解决div mouseout事件冒泡的问题</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.steveluo.name/jquery-mouseleave-instead-of-mouseout/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>CSS透明度在各浏览器下的兼容实现</title>
		<link>http://www.steveluo.name/css-opacity-all-browsers-hack/</link>
		<comments>http://www.steveluo.name/css-opacity-all-browsers-hack/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 03:30:18 +0000</pubDate>
		<dc:creator>Steve Luo</dc:creator>
				<category><![CDATA[前端技术]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://www.steveluo.name/?p=208</guid>
		<description><![CDATA[几款浏览器对透明度的支持方式各不相同，为了保证在IE, Firefox, Chrome, Safari等主流浏览器下都能正常显示透明度的效果，我们可以定义一个透明度的class，因为一写就要写3条，省的每次都复制来复制去了。 具体代码如下： .transparent{ filter:alpha(opacity=60); /*支持 IE 浏览器*/ -moz-opacity:0.60; /*支持 FireFox 浏览器*/ opacity:0.60; /*支持 Chrome, Opera, Safari 等浏览器*/ }]]></description>
			<content:encoded><![CDATA[<p>几款浏览器对透明度的支持方式各不相同，为了保证在IE, Firefox, Chrome, Safari等主流浏览器下都能正常显示透明度的效果，我们可以定义一个透明度的class，因为一写就要写3条，省的每次都复制来复制去了。<br />
<strong>具体代码如下：</strong></p>
<pre name="code" class="css">
.transparent{
filter:alpha(opacity=60);  /*支持 IE 浏览器*/
-moz-opacity:0.60; /*支持 FireFox 浏览器*/
opacity:0.60;  /*支持 Chrome, Opera, Safari 等浏览器*/
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.steveluo.name/css-opacity-all-browsers-hack/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用jQuery清空file文件域的方法</title>
		<link>http://www.steveluo.name/jquery-clear-file-input-value/</link>
		<comments>http://www.steveluo.name/jquery-clear-file-input-value/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 04:53:37 +0000</pubDate>
		<dc:creator>Steve Luo</dc:creator>
				<category><![CDATA[前端技术]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[网站]]></category>
		<category><![CDATA[表单]]></category>

		<guid isPermaLink="false">http://www.steveluo.name/?p=204</guid>
		<description><![CDATA[一般来说，在对一个文件域(input type=&#8221;file&#8221;)使用了验证后，我们总会希望把文件域中的值给清空了（否则错误的文件仍然会被提交），而在IE中，安全设置的原因，是不允许更改文件域的值的（也就是不能使用val(&#8220;&#8221;)） 那么很显然，我们就只能换个思路，把这个input元素复制一个，然后将原来的删除。 在IE下复制元素的时候，其中的值是不会被复制的，所以就达到了清空文件域的目的了。 而在Firefox下，其中的值也会被一同复制，那么我们就顺便清空一下就做到兼容了。 代码如下： var file = $(":file"); file.after(file.clone().val("")); file.remove();]]></description>
			<content:encoded><![CDATA[<p>一般来说，在对一个文件域(input type=&#8221;file&#8221;)使用了验证后，我们总会希望把文件域中的值给清空了（否则错误的文件仍然会被提交），而在IE中，安全设置的原因，是不允许更改文件域的值的（也就是不能使用val(&#8220;&#8221;)）</p>
<p>那么很显然，我们就只能换个思路，把这个input元素复制一个，然后将原来的删除。<br />
在IE下复制元素的时候，其中的值是不会被复制的，所以就达到了清空文件域的目的了。<br />
而在Firefox下，其中的值也会被一同复制，那么我们就顺便清空一下就做到兼容了。<br />
代码如下：</p>
<pre name="code" class="javascript">
var file = $(":file");
file.after(file.clone().val(""));
file.remove();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.steveluo.name/jquery-clear-file-input-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

