<?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>网站前端,web前端,前端脚本,前端优化&#124;时代前端 &#187; jQuery</title>
	<atom:link href="http://www.52shidai.com/category/jquery/feed" rel="self" type="application/rss+xml" />
	<link>http://www.52shidai.com</link>
	<description>网站前端研究中心</description>
	<lastBuildDate>Thu, 02 Feb 2012 03:36:54 +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>jQ.Mobi—针对移动设备优化的jQuery</title>
		<link>http://www.52shidai.com/javascript/jquery/926.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/926.html#comments</comments>
		<pubDate>Thu, 02 Feb 2012 03:06:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[前端优化]]></category>
		<category><![CDATA[jQ.Mobi]]></category>
		<category><![CDATA[移动设备]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=926</guid>
		<description><![CDATA[appMobi已经开放了jQ.Mobi的源代码，它对jQuery进行了重写，与jQuery Mobile竞争以分享开发者份额。 jQ.Mobi是jQuery的部分重写版本，但针对HTML5和移动设备做了优化。它的文件大小只有3KB，而jQuery则有35KB，并且据JSPerf test的数据，它在Android上要比jQuery快3倍，在iOS上快2.2倍。该框架是由appMobi发布并开源的。因为jQ.Mobi是插件式开发，所以它的编程语法和jQuery完全相同。jQ.Mobi只包含jQuery API的子集，也就是appMobi认为给iOS和Android提供完全相同用户体验最重要的那部分。 jQ.Mobi由三个组件组成： 查询（query）程序库 jQ.Ui——为WebKit浏览器提供的用户界面程序库 jQ.Plugin——针对WebKit浏览器的插件支持 他们创建了一个演示来展现框架的功能。 人们为什么要在jQuery团队发布了jQuery Mobile 1.0两个月之后，又创建了新的基于jQuery的JavaScript框架呢？appMobi这样做的原因在于，jQuery植根于桌面浏览器，因此他们的移动版本并没有很好地优化，并且也无法在移动设备上——特别是在Android设备中——提供良好的体验。 jQuery团队的移动领域主管Todd Parker承认jQuery Mobile中存在一些问题，并且团队刚刚发布了维护版本（1.0.1），其中修正了大量缺陷，他们还会在1.2版本中提供更多小工具并做出改进。 查看英文原文：jQ.Mobi – jQuery Optimized for Mobile Devices 您可能感兴趣的文章jQuery-bind不能处理绑定hover事件9个实用jQuery日历插件jQuery 操作css 设置样式JQUERY操作XML实例教程不要滥用jQuery的$(this)编写高性能的jQuery代码jQuery中的mouseenter和mouseleave事件流动导航菜单-Fluid Navigation 使用Jquery+CSS创建高亮显示文本中重要关键字（Jquery ）12个用jQuery插件改变Button按钮的漂亮特效]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.52shidai.com/?attachment_id=4232" rel="attachment wp-att-4232"><img title="QQ截图20120131164856" src="http://www.mhtml5.com/wp-content/uploads/2012/01/QQ%E6%88%AA%E5%9B%BE20120131164856.jpg" alt="" width="283" height="323" /></a></p>
<p>appMobi已经开放了<a href="http://www.jqmobi.com/">jQ.Mobi</a>的源代码，它对<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>进行了重写，与<a href="http://jquerymobile.com/">jQuery Mobile</a>竞争以分享开发者份额。</p>
<p><a href="http://jqmobi.com/">jQ.Mobi</a>是<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>的部分重写版本，但针对HTML5和<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e7%a7%bb%e5%8a%a8%e8%ae%be%e5%a4%87" title="查看 移动设备 中的全部文章" target="_blank">移动设备</a></span>做了优化。它的文件大小只有3KB，而<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>则有35KB，并且据<a href="http://jsperf.com/jqm3/4">JSPerf test</a>的数据，它在Android上要比jQuery快3倍，在iOS上快2.2倍。该框架是由<a href="http://www.appmobi.com/">appMobi</a>发布并开源的。因为<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jq-mobi" title="查看 jQ.Mobi 中的全部文章" target="_blank">jQ.Mobi</a></span>是插件式开发，所以它的编程语法和jQuery完全相同。<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jq-mobi" title="查看 jQ.Mobi 中的全部文章" target="_blank">jQ.Mobi</a></span>只包含jQuery API的子集，也就是appMobi认为给iOS和Android提供完全相同用户体验最重要的那部分。</p>
<p>jQ.Mobi由三个组件组成：</p>
<ul>
<li>查询（query）程序库</li>
<li>jQ.Ui——为WebKit浏览器提供的用户界面程序库</li>
<li>jQ.Plugin——针对WebKit浏览器的插件支持</li>
</ul>
<p>他们创建了一个<a href="http://www.jqmobi.com/testdrive/index.html">演示</a>来展现框架的功能。</p>
<p>人们为什么要在jQuery团队发布了<a href="http://jquerymobile.com/">jQuery Mobile 1.0</a>两个月之后，又创建了新的基于jQuery的JavaScript框架呢？appMobi这样做的原因在于，jQuery植根于桌面浏览器，因此他们的移动版本并没有很好地优化，并且也无法在<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e7%a7%bb%e5%8a%a8%e8%ae%be%e5%a4%87" title="查看 移动设备 中的全部文章" target="_blank">移动设备</a></span>上——特别是在Android设备中——提供良好的体验。</p>
<p>jQuery团队的移动领域主管Todd Parker承认<a href="http://jquerymobile.com/blog/2012/01/10/upcoming-releases-1-0-1-1-1-and-beyond/">jQuery Mobile中存在一些问题</a>，并且团队刚刚发布了维护版本（<a href="http://jquerymobile.com/blog/2012/01/26/jquery-mobile-1-0-1-released/">1.0.1</a>），其中修正了大量缺陷，他们还会在1.2版本中提供更多小工具并做出改进。</p>
<p><strong>查看英文原文：</strong><a href="http://www.infoq.com/news/2012/01/jQMobi">jQ.Mobi – jQuery Optimized for Mobile Devices</a></p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/926.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Path的Menu菜单（加号）效果</title>
		<link>http://www.52shidai.com/javascript/jquery/832.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/832.html#comments</comments>
		<pubDate>Tue, 13 Dec 2011 03:39:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[html5/css3]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[Path]]></category>
		<category><![CDATA[效果]]></category>
		<category><![CDATA[菜单]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=832</guid>
		<description><![CDATA[Path最新的更新，通过优秀的用户体验设计赢得了大批用户和业内的好评，被成为移动版的“Facebook”！一时之间，在国内你如果不知道Path2.0的话，你就OUT了。 Path 2的UI设计相当出色。最核心的是左下角的红白色加号按钮，点击后会出现6类功能，依次是：照片、和谁在一起、当前地点、在听的音乐、在想的事情、以及睡眠，使用起来得心应手，十分方便。 你不仅可以和Path好友分享，还能把你的分享发布到Facebook或Foursquare等网站上。和之前版本相比，Path 2从侧重照片分享走向“分享一切”、好友上限从50人增加到150人。 除了在产品圈热议之外；其实在技术圈，被讨论最多的是path那个Menu的实现问题。所有给力的产品都离不开程序猿同学的各种努力，看看怎样用不同的语言实现Path2.0的Menu效果！ @LeveyZhu 的实现效果： https://github.com/levey/QuadCurveMenu Tunghsiao Liu ：CSS实现的效果：http://sparanoid.com/lab/path-menu/ 一老外兄弟的实现：https://github.com/beaucollins/radial-menu Benzhe ：javacript实现 https://github.com/ben304/Path2.0-Menu/ 再来一个CSS实现：http://lab.victorcoulon.fr/css/path-menu/ 貌似被ban 本文实现方式整理自中文技术问答网站SegmentFault 您可能感兴趣的文章非常经典动画导航菜单效果代码jquery 经典动画菜单效果]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.52shidai.com/wp-content/uploads/2011/12/path-menu-xiaoguo.jpg"><img class="alignnone size-full wp-image-833" title="Path的Menu菜单（加号）效果" src="http://www.52shidai.com/wp-content/uploads/2011/12/path-menu-xiaoguo.jpg" alt="Path的Menu菜单（加号）效果" width="278" height="400" /></a></p>
<p><a href="http://path.com/" target="_blank">Path</a>最新的更新，通过优秀的用户体验设计赢得了大批用户和业内的好评，被成为移动版的“Facebook”！一时之间，在国内你如果不知道<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/path" title="查看 Path 中的全部文章" target="_blank">Path</a></span>2.0的话，你就OUT了。</p>
<p><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/path" title="查看 Path 中的全部文章" target="_blank">Path</a></span> 2的UI设计相当出色。最核心的是左下角的红白色加号按钮，点击后会出现6类功能，依次是：照片、和谁在一起、当前地点、在听的音乐、在想的事情、以及睡眠，使用起来得心应手，十分方便。</p>
<p>你不仅可以和Path好友分享，还能把你的分享发布到Facebook或Foursquare等网站上。和之前版本相比，Path 2从侧重照片分享走向“分享一切”、好友上限从50人增加到150人。</p>
<p>除了在产品圈热议之外；其实在技术圈，被讨论最多的是path那个<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/menu" title="查看 Menu 中的全部文章" target="_blank">Menu</a></span>的实现问题。所有给力的产品都离不开程序猿同学的各种努力，看看怎样用不同的语言实现Path2.0的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/menu" title="查看 Menu 中的全部文章" target="_blank">Menu</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%95%88%e6%9e%9c" title="查看 效果 中的全部文章" target="_blank">效果</a></span>！</p>
<ol>
<li><a href="https://twitter.com/#!/LeveyZhu" target="_blank">@LeveyZhu</a> 的实现<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%95%88%e6%9e%9c" title="查看 效果 中的全部文章" target="_blank">效果</a></span>： <a href="https://github.com/levey/QuadCurveMenu" target="_blank">https://github.com/levey/QuadCurveMenu</a></li>
<li>Tunghsiao Liu ：CSS实现的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%95%88%e6%9e%9c" title="查看 效果 中的全部文章" target="_blank">效果</a></span>：<a href="http://sparanoid.com/lab/path-menu/" target="_blank">http://sparanoid.com/lab/path-menu/</a></li>
<li>一老外兄弟的实现：<a href="https://github.com/beaucollins/radial-menu" target="_blank">https://github.com/beaucollins/radial-menu</a></li>
<li>Benzhe ：javacript实现 <a href="https://github.com/ben304/Path2.0-Menu/" target="_blank">https://github.com/ben304/Path2.0-Menu/</a></li>
<li>再来一个CSS实现：<a href="http://lab.victorcoulon.fr/css/path-menu/" target="_blank">http://lab.victorcoulon.fr/css/path-menu/</a> 貌似被ban</li>
</ol>
<p>本文实现方式整理自中文技术问答网站<a href="http://segmentfault.com/question/761/" target="_blank">SegmentFault</a></p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/333.html" title="非常经典动画导航菜单效果代码">非常经典动画导航菜单效果代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/83.html" title="jquery 经典动画菜单效果">jquery 经典动画菜单效果</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/832.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery-bind不能处理绑定hover事件</title>
		<link>http://www.52shidai.com/javascript/jquery/748.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/748.html#comments</comments>
		<pubDate>Wed, 03 Aug 2011 03:29:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[hover]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/jquery/748.html</guid>
		<description><![CDATA[看这个例子： $(document).ready(function(){ $('.some-class').bind({ hover: function(e) { // Hover event handler alert("hover"); }, click: function(e) { // Click event handler alert("click"); }, blur: function(e) { // Blur event handler } }); }); 奇怪的事情发生了，这里的 “hover” 事件完全没有反应。 而像 “click” 和 “blur” 这两个都能正常调用。 同时，如下的代码也是正常运行的： $(".some-class").hover(function(){ // stuff }) 为什么 bind 不能绑定 hover 呢？ 答案是： 应该使用 mouseenter 和 mouseleave 这两个事件来代替 [...]]]></description>
			<content:encoded><![CDATA[<p>看这个例子：</p>
<p><span style="color: #a5a5a5;"><code>$(document).ready(</code><code>function</code><code>(){</code></span></p>
<p><span style="color: #a5a5a5;"><code>$(</code><code>'.some-class'</code><code>).<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/bind" title="查看 bind 中的全部文章" target="_blank">bind</a></span>({</code></span></p>
<p><span style="color: #a5a5a5;"><code><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/hover" title="查看 hover 中的全部文章" target="_blank">hover</a></span>: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Hover event handler</span></code></p>
<p><span style="color: #a5a5a5;"><code>alert(</code><code>"<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/hover" title="查看 hover 中的全部文章" target="_blank">hover</a></span>"</code><code>);</code></span></p>
<p><code><span style="color: #a5a5a5;">},</span></code></p>
<p><span style="color: #a5a5a5;"><code>click: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Click event handler</span></code></p>
<p><span style="color: #a5a5a5;"><code>alert(</code><code>"click"</code><code>);</code></span></p>
<p><code><span style="color: #a5a5a5;">},</span></code></p>
<p><span style="color: #a5a5a5;"><code>blur: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Blur event handler</span></code></p>
<p><code><span style="color: #a5a5a5;">}</span></code></p>
<p><code><span style="color: #a5a5a5;">});</span></code></p>
<p><code><span style="color: #a5a5a5;">});</span></code></p>
<p>奇怪的事情发生了，这里的 “<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/hover" title="查看 hover 中的全部文章" target="_blank">hover</a></span>” 事件完全没有反应。 而像 “click” 和 “blur” 这两个都能正常调用。</p>
<p>同时，如下的代码也是正常运行的：</p>
<p><span style="color: #a5a5a5;"><code>$(</code><code>".some-class"</code><code>).hover(</code><code>function</code><code>(){</code></span></p>
<p><code><span style="color: #a5a5a5;">// stuff</span></code></p>
<p><code><span style="color: #a5a5a5;">})</span></code></p>
<p>为什么 <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/bind" title="查看 bind 中的全部文章" target="_blank">bind</a></span> 不能绑定 hover 呢？</p>
<p>答案是：<br />
应该使用 mouseenter 和 mouseleave 这两个事件来代替 (这也是 .hover() 函数中使用的事件)  所以完全可以直接像这样来引用:</p>
<p><span style="color: #a5a5a5;"><code>$(document).ready(</code><code>function</code><code>(){</code></span></p>
<p><span style="color: #a5a5a5;"><code>$(</code><code>'.some-class'</code><code>).bind({</code></span></p>
<p><span style="color: #a5a5a5;"><code>mouseenter: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Hover event handler</span></code></p>
<p><span style="color: #a5a5a5;"><code>alert(</code><code>"hover"</code><code>);</code></span></p>
<p><code><span style="color: #a5a5a5;">},</span></code></p>
<p><span style="color: #a5a5a5;"><code>mouseleave: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Hover event handler</span></code></p>
<p><span style="color: #a5a5a5;"><code>alert(</code><code>"hover"</code><code>);</code></span></p>
<p><code><span style="color: #a5a5a5;">},</span></code></p>
<p><span style="color: #a5a5a5;"><code>click: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Click event handler</span></code></p>
<p><span style="color: #a5a5a5;"><code>alert(</code><code>"click"</code><code>);</code></span></p>
<p><code><span style="color: #a5a5a5;">},</span></code></p>
<p><span style="color: #a5a5a5;"><code>blur: </code><code>function</code><code>(e) {</code></span></p>
<p><code><span style="color: #a5a5a5;">// Blur event handler</span></code></p>
<p><code><span style="color: #a5a5a5;">}</span></code></p>
<p><code><span style="color: #a5a5a5;">});</span></code></p>
<p><code><span style="color: #a5a5a5;">});</span></code></p>
<p>因为 .hover() 是 <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span> 自己定义的事件… 是为了方便用户绑定调用 mouseenter 和 mouseleave  事件而已，它并非一个真正的事件，所以当然不能当做 .bind() 中的事件参数来调用。</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/748.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>9个实用jQuery日历插件</title>
		<link>http://www.52shidai.com/javascript/jquery/738.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/738.html#comments</comments>
		<pubDate>Tue, 12 Jul 2011 03:44:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[日历插件]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/jquery/738.html</guid>
		<description><![CDATA[1. FullCalendar FullCalendar是很出名的jQuery日历插件，它支持拖拽等功能，整合了Google Calendar，而且可以通过JSON来绑定事件，设计师可以轻松地自定义日历样式，工程师则利用它提供的接口来处理用户触发事件。 2. Astonishing iCal-like Calendar 这里是一篇教程，教你如何利用jQuery和CSS制作一个模仿iphone样式的日历控件。 3. jQuery UI Datepicker jQuery UI Datepicker 是一个提供了很多配置项的日历插件，你可以自定义日期的格式和语言，可通过按钮限制可选的日期范围，也可轻松地添加其他功能的按钮。 4. jMonthCalendar jMonthCalendar支持没个月份里的所有天数添加内容，本身可以应用到开发工作中。 5. Date Picker Date Picker 遵循MIT &#38; GPL发布.，有着很多的配置项和特性，例如你可以同时打开多个日期选择器，轻松地通过修改css来自定义样式，支持多种日期选择模式。 6. jQuery Week Calendar jQuery Week Calendar 是一个在web应用中显示一周情况的插件，可以通过数据或者JSON来绑定相应的触发事件，而且这些事件都可以拖拽、缩放，而且还有很多选项和事件回调函数可以使用在应用中，具体的可以参考官方文档。 7. Simple jQuery Date-picker Plugin 这是一个很简洁的日期选择器，但是提供了很多实用功能。 8. jQuery Date Picker Plugin 跟上面介绍的类似，在显示风格上略有区别。 9. jQuery Interactive Date Range Picker 这个强大的日历控件时jQqueryUI中日历组建的改良版，它有十分平滑的显示过渡效果，最新版使用的是jQuery UI 1.7 一级 jQuery UI CSS 框架，你可以通过jQuery UI来修改出自己期望的效果. &#160; 您可能感兴趣的文章jQ.Mobi—针对移动设备优化的jQueryjQuery-bind不能处理绑定hover事件jQuery 操作css [...]]]></description>
			<content:encoded><![CDATA[<h3>1. <a title="FullCalendar" href="http://arshaw.com/fullcalendar/" target="_blank">FullCalendar</a></h3>
<p>FullCalendar是很出名的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%97%a5%e5%8e%86%e6%8f%92%e4%bb%b6" title="查看 日历插件 中的全部文章" target="_blank">日历插件</a></span>，它支持拖拽等功能，整合了Google Calendar，而且可以通过JSON来绑定事件，设计师可以轻松地自定义日历样式，工程师则利用它提供的接口来处理用户触发事件。<br />
<img title="FullCalendar" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081705982.jpg" alt="FullCalendar" width="500" height="396" /></p>
<h3>2. <a title="Astonishing iCal-like Calendar" href="http://www.stefanoverna.com/log/create-astonishing-ical-like-calendars-with-jquery" target="_blank">Astonishing iCal-like Calendar</a></h3>
<p>这里是一篇教程，教你如何利用<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>和CSS制作一个模仿iphone样式的日历控件。<img title="Astonishing iCal-like Calendar" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081706130.jpg" alt="Astonishing iCal-like Calendar" width="500" height="454" /></p>
<h3>3. <a title="jQuery" href="http://docs.jquery.com/UI/Datepicker" target="_blank" >jQuery UI Datepicker</a></h3>
<p>jQuery UI Datepicker 是一个提供了很多配置项的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%97%a5%e5%8e%86%e6%8f%92%e4%bb%b6" title="查看 日历插件 中的全部文章" target="_blank">日历插件</a></span>，你可以自定义日期的格式和语言，可通过按钮限制可选的日期范围，也可轻松地添加其他功能的按钮。</p>
<p><img title="jQuery UI Datepicker" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081707960.jpg" alt="jQuery UI Datepicker" width="500" height="171" /></p>
<h3>4. <a title="jMonthCalendar" href="http://www.bytecyclist.com/projects/jmonthcalendar/" target="_blank">jMonthCalendar</a></h3>
<p>jMonthCalendar支持没个月份里的所有天数添加内容，本身可以应用到开发工作中。</p>
<p><img title="jMonthCalendar" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081707757.jpg" alt="jMonthCalendar" width="500" height="237" /></p>
<h3>5. <a title="Date Picker" href="http://www.eyecon.ro/datepicker/" target="_blank">Date Picker</a></h3>
<p>Date Picker 遵循MIT &amp; GPL发布.，有着很多的配置项和特性，例如你可以同时打开多个日期选择器，轻松地通过修改css来自定义样式，支持多种日期选择模式。</p>
<p><img title="Date Picker" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081708336.jpg" alt="Date Picker" width="500" height="135" /></p>
<h3>6. <a title="jQuery Week Calendar" href="http://www.redredred.com.au/projects/jquery-week-calendar/" target="_blank">jQuery Week Calendar</a></h3>
<p>jQuery Week Calendar 是一个在web应用中显示一周情况的插件，可以通过数据或者JSON来绑定相应的触发事件，而且这些事件都可以拖拽、缩放，而且还有很多选项和事件回调函数可以使用在应用中，具体的可以参考官方文档。<img title="jQuery Week Calendar" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081708953.jpg" alt="jQuery Week Calendar" width="500" height="285" /></p>
<h3>7. <a title="Simple jQuery Date-picker Plugin" href="http://teddevito.com/demos/calendar.php" target="_blank">Simple jQuery Date-picker Plugin</a></h3>
<p>这是一个很简洁的日期选择器，但是提供了很多实用功能。</p>
<p><img title="Simple jQuery Date-picker Plugin" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081709998.jpg" alt="Simple jQuery Date-picker Plugin" width="500" height="218" /></p>
<h3>8. <a title="jQuery Date Picker Plugin" href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/" target="_blank">jQuery Date Picker Plugin</a></h3>
<p>跟上面介绍的类似，在显示风格上略有区别。<br />
<img title="jQuery Date Picker Plugin" src="http://www.bobd.cn/design/UploadFiles1008/200910/20091013081709170.jpg" alt="jQuery Date Picker Plugin" width="500" height="220" /></p>
<h3>9. <a title="jQuery Interactive Date Range Picker" href="http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/" target="_blank">jQuery Interactive Date Range Picker</a></h3>
<p>这个强大的日历控件时jQqueryUI中日历组建的改良版，它有十分平滑的显示过渡效果，最新版使用的是jQuery UI 1.7 一级 jQuery UI CSS 框架，你可以通过jQuery UI来修改出自己期望的效果.</p>
<p>&nbsp;</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/738.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery 操作css 设置样式</title>
		<link>http://www.52shidai.com/javascript/jquery/732.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/732.html#comments</comments>
		<pubDate>Mon, 16 May 2011 09:57:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[css样式]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/jquery/732.html</guid>
		<description><![CDATA[pcss(name) br /访问第一个匹配元素的样式属性。/p p&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;/p pReturn a style property on the first matched element. br /返回值 br /String/p p参数 br /name (String) : 要访问的属性名称/p p示例 br /取得第一个段落的color样式属性的值。 /p pjQuery 代码:/p p$(quot;pquot;).css(quot;colorquot;); /p pcss(properties) br /把一个“名/值对”对象设置为所有匹配元素的样式属性。 br /这是一种在所有匹配的元素上设置大量样式属性的最佳方式。/p p&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;/p pSet a key/value object as style properties to all matched elements. br /This is the best way to [...]]]></description>
			<content:encoded><![CDATA[<p>pcss(name)   br /访问第一个匹配元素的样式属性。/p  p&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;/p  pReturn a style property on the first matched element.   br /返回值    br /String/p  p参数   br /name (String) : 要访问的属性名称/p  p示例   br /取得第一个段落的color样式属性的值。 /p  p<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span> 代码:/p  p$(quot;pquot;).css(quot;colorquot;); /p  pcss(properties)   br /把一个“名/值对”对象设置为所有匹配元素的样式属性。    br /这是一种在所有匹配的元素上设置大量样式属性的最佳方式。/p  p&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;/p  pSet a key/value object as style properties to all matched elements.   br /This is the best way to set several style properties on all matched elements.    br /返回值    br /<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>/p  p参数   br /properties (Map) : 要设置为样式属性的名/值对/p  p示例   br /将所有段落的字体颜色设为红色并且背景为蓝色。 /p  pjQuery 代码:/p  p$(quot;pquot;).css({ color: quot;#ff0011quot;, background: quot;bluequot; });    br /&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;/p  p如果属性名包含 quot;-quot;的话，必须使用引号: /p  pjQuery 代码:/p  p$(quot;pquot;).css({ quot;margin-leftquot;: quot;10pxquot;, quot;background-colorquot;: quot;bluequot; }); /p  pcss(name,value)   br /在所有匹配的元素中，设置一个样式属性的值。    br /数字将自动转化为像素值/p  p&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;/p  pSet a single style property to a value on all matched elements.   br /If a number is provided, it is automatically converted into a pixel value.    br /返回值    br /jQuery/p  p参数   br /name (value) : 属性名/p  pvalue (String, Number) : 属性值/p  p示例   br /将所有段落字体设为红色 /p  pjQuery 代码:/p  p$(quot;pquot;).css(quot;colorquot;,quot;redquot;); /p</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/732.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JQUERY操作XML实例教程</title>
		<link>http://www.52shidai.com/javascript/jquery/705.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/705.html#comments</comments>
		<pubDate>Tue, 22 Mar 2011 14:34:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[实例教程]]></category>
		<category><![CDATA[操作XML]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=705</guid>
		<description><![CDATA[JQUERY操作XML实例教程 text.xml &#60;?xml version=”1.0&#8243; encoding=”utf-8&#8243; ?&#62; &#60;msglist&#62; &#60;msg name=”11&#8243;&#62; &#60;id&#62;1&#60;/id&#62; &#60;content&#62;content1&#60;/content&#62; &#60;/msg&#62; &#60;msg name=”22&#8243;&#62; &#60;id&#62;2&#60;/id&#62; &#60;content&#62;content2&#60;/content&#62; &#60;/msg&#62; &#60;/msglist&#62; index.html &#60;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&#62; &#60;html xmlns=”http://www.w3.org/1999/xhtml” &#62; &#60;head runat=”server”&#62; &#60;title&#62;jQuery操作Xml入门&#60;/title&#62; &#60;script type=”text/javascript” src=”jquery-1.4.4.min.js”&#62;&#60;/script&#62; &#60;script type=”text/javascript”&#62; $(function(){    $.ajax({        url : “test.xml”,     dataType : “xml”,     error : function(xml) {         [...]]]></description>
			<content:encoded><![CDATA[<p><strong>JQUERY<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%93%8d%e4%bd%9cxml" title="查看 操作XML 中的全部文章" target="_blank">操作XML</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e5%ae%9e%e4%be%8b%e6%95%99%e7%a8%8b" title="查看 实例教程 中的全部文章" target="_blank">实例教程</a></span></strong></p>
<p><strong>text.xml </strong></p>
<p>&lt;?xml version=”1.0&#8243; encoding=”utf-8&#8243; ?&gt;<br />
&lt;msglist&gt;<br />
&lt;msg name=”11&#8243;&gt;<br />
&lt;id&gt;1&lt;/id&gt;<br />
&lt;content&gt;content1&lt;/content&gt;<br />
&lt;/msg&gt;<br />
&lt;msg name=”22&#8243;&gt;<br />
&lt;id&gt;2&lt;/id&gt;<br />
&lt;content&gt;content2&lt;/content&gt;<br />
&lt;/msg&gt;<br />
&lt;/msglist&gt;</p>
<p><strong>index.html </strong></p>
<p>&lt;!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;<br />
&lt;html xmlns=”http://www.w3.org/1999/xhtml” &gt;<br />
&lt;head runat=”server”&gt;<br />
&lt;title&gt;<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>操作Xml入门&lt;/title&gt;<br />
&lt;script type=”text/javascript” src=”jquery-1.4.4.min.js”&gt;&lt;/script&gt;<br />
&lt;script type=”text/javascript”&gt;<br />
$(function(){<br />
   $.ajax({<br />
       url : “test.xml”,<br />
    dataType : “xml”,<br />
    error : function(xml) {<br />
        alert(“Error loading XML document ” + xml);<br />
    },<br />
    success : function(xml) {<br />
        $(xml).find(“msglist &gt; msg”).each(function() {<br />
        // $(this).find(“content”).text(); //取值<br />
    //  $(“ul”).append(“&lt;li&gt;” + $(this).find(“content”).text() + “&lt;/li&gt;”);<br />
     $(“ul”).append(“&lt;li&gt;” + $(this).attr(“name”) + “&lt;/li&gt;”);<br />
      //($(this).attr(“name”));  //获取属性<br />
     });<br />
    }<br />
   });<br />
});<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;ul&gt;&lt;/ul&gt;<br />
&lt;/form&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/705.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>不要滥用jQuery的$(this)</title>
		<link>http://www.52shidai.com/javascript/jquery/621.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/621.html#comments</comments>
		<pubDate>Tue, 16 Nov 2010 08:39:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=621</guid>
		<description><![CDATA[如果不了解javasrcipt中基本的DOM属性和方法的话，很容易滥用jQuery对象。比如： $(&#8216;#someAnchor&#8217;).click(function() { alert( $(this).attr(&#8216;id&#8217;) ); }); 如果你只是通过jQ对象获取简单的dom元素的属性比如id，那么你完全可以使用js原生的方法： $(&#8216;#someAnchor&#8217;).click(function() { alert( this.id ); }); 诸如“src,” “href,” 和“style.”等一些属性在老版本的ie中使用了getAttribute方法。 您可能感兴趣的文章jQ.Mobi—针对移动设备优化的jQueryjQuery-bind不能处理绑定hover事件9个实用jQuery日历插件jQuery 操作css 设置样式JQUERY操作XML实例教程编写高性能的jQuery代码jQuery中的mouseenter和mouseleave事件流动导航菜单-Fluid Navigation 使用Jquery+CSS创建高亮显示文本中重要关键字（Jquery ）12个用jQuery插件改变Button按钮的漂亮特效]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">
<div id="_mcePaste">如果不了解javasrcipt中基本的DOM属性和方法的话，很容易滥用<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>对象。比如：</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">$(&#8216;#someAnchor&#8217;).click(function() {</div>
<div id="_mcePaste">alert( $(this).attr(&#8216;id&#8217;) );</div>
<div id="_mcePaste">});</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">如果你只是通过jQ对象获取简单的dom元素的属性比如id，那么你完全可以使用js原生的方法：</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">$(&#8216;#someAnchor&#8217;).click(function() {</div>
<div id="_mcePaste">alert( this.id );</div>
<div id="_mcePaste">});</div>
<div id="_mcePaste"></div>
<div id="_mcePaste">诸如“src,” “href,” 和“style.”等一些属性在老版本的ie中使用了getAttribute方法。</div>
</div>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/621.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>编写高性能的jQuery代码</title>
		<link>http://www.52shidai.com/javascript/jquery/619.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/619.html#comments</comments>
		<pubDate>Tue, 16 Nov 2010 08:34:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[代码]]></category>
		<category><![CDATA[性能]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=619</guid>
		<description><![CDATA[这意味着，正如我们必须优化JavaScript for语句一样，我们必须优化jQuery的each方法。 // jQuery&#8217;s each method source each: function( object, callback, args ) { var name, i = 0, length = object.length, isObj = length === undefined &#124;&#124; jQuery.isFunction(object); if ( args ) { if ( isObj ) { for ( name in object ) { if ( callback.apply( object[ name ], args ) === [...]]]></description>
			<content:encoded><![CDATA[<p>这意味着，正如我们必须优化JavaScript for语句一样，我们必须优化<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>的<code>each</code>方法。</p>
<div id="_mcePaste">// <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>&#8217;s each method source</div>
<div id="_mcePaste"><span style="color: #ff6600;">each: function( object, callback, args ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">var name, i = 0,</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">length = object.length,</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">isObj = length === undefined || <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>.isFunction(object);</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">if ( args ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">if ( isObj ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">for ( name in object ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">if ( callback.apply( object[ name ], args ) === false ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">break;</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">} else {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">for ( ; i &lt; length; ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">if ( callback.apply( object[ i++ ], args ) === false ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">break;</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">// A special, fast, case for the most common use of each</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">} else {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">if ( isObj ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">for ( name in object ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">if ( callback.call( object[ name ], name, object[ name ] ) === false ) {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">break;</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">} else {</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">for ( var value = object[0];</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">i &lt; length &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; callback.call( value, i, value ) !== false; value = object[++i] ) {}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">return object;</span></div>
<div id="_mcePaste"><span style="color: #ff6600;">}</span></div>
<p><span style="color: #ff6600;">// jQuery&#8217;s each method source	each: function( object, callback, args ) {		var name, i = 0,			length = object.length,			isObj = length === undefined || jQuery.isFunction(object);<br />
if ( args ) {			if ( isObj ) {				for ( name in object ) {					if ( callback.apply( object[ name ], args ) === false ) {						break;					}				}			} else {				for ( ; i &lt; length; ) {					if ( callback.apply( object[ i++ ], args ) === false ) {						break;					}				}			}<br />
// A special, fast, case for the most common use of each		} else {			if ( isObj ) {				for ( name in object ) {					if ( callback.call( object[ name ], name, object[ name ] ) === false ) {						break;					}				}			} else {				for ( var value = object[0];					i &lt; length &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; callback.call( value, i, value ) !== false; value = object[++i] ) {}			}		}<br />
return object;	}</span><br />
<span style="font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; line-height: 21px; font-size: 14px; color: #535353;">糟糕的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e4%bb%a3%e7%a0%81" title="查看 代码 中的全部文章" target="_blank">代码</a></span>：</span></p>
<p><span style="font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; line-height: 21px; font-size: 14px; color: #535353;"> </span><span style="color: #ff6600;">someDivs.each(function()&amp;nbsp;{</span></p>
<p><span style="color: #ff6600;"> $(&#8216;#anotherDiv&#8217;)[0].innerHTML&amp;nbsp;+=&amp;nbsp;$(this).text();</span></p>
<p><span style="color: #ff6600;">});</span></p>
<ol style="margin-top: 15px; margin-right: 0px; margin-bottom: 20px; margin-left: -10px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 15px; list-style-type: none; list-style-position: initial; list-style-image: initial; overflow-x: hidden; overflow-y: hidden;">
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 15px; float: left; width: 1032px; color: #535353; font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; padding: 0px;">在<em>每一次遍历循环</em>中都会搜寻anotherDiv 这个ID的元素</li>
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 15px; float: left; width: 1032px; color: #535353; font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; padding: 0px;"><em>两次</em>获取innerHTML属性</li>
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 15px; float: left; width: 1032px; color: #535353; font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; padding: 0px;">创建了一个<em>jQuery对象</em>，只是为了获取元素的text属性</li>
<p style="padding-top: 15px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; width: 1032px; color: #535353; font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; margin: 0px;">优化的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e4%bb%a3%e7%a0%81" title="查看 代码 中的全部文章" target="_blank">代码</a></span>：</p>
</ol>
<p><span style="color: #ff6600;">var someDivs = $(&#8216;#container&#8217;).find(&#8216;.someDivs&#8217;),</span></p>
<p><span style="color: #ff6600;">contents = [];</span></p>
<p><span style="color: #ff6600;"><br />
</span></p>
<p><span style="color: #ff6600;">someDivs.each(function() {</span></p>
<p><span style="color: #ff6600;">contents.push( this.innerHTML );</span></p>
<p><span style="color: #ff6600;">});</span></p>
<p><span style="color: #ff6600;">$(&#8216;#anotherDiv&#8217;).html( contents.join(”) );</span></p>
<div><span style="font-family: 'Microsoft YaHei', verdana, Arial, Helvetica, sans-serif; line-height: 21px; font-size: 14px; color: #535353;">这样，在<code style="padding: 0px; margin: 0px;">each</code> (for)方法，我们唯一要执行任务的关键是增加一个新的到一个数组…而不是查询DOM中，取代了元素两次获取innerHTML属性等。</span></div>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/web-front/852.html" title="Firefox 9正式版可下载，提升JavaScript性能20-30%">Firefox 9正式版可下载，提升JavaScript性能20-30%</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/wordpress/680.html" title="Wordpress最新文章代码和随机文章代码">Wordpress最新文章代码和随机文章代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/619.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>上下拉幕横幅广告效果-基于jQuery</title>
		<link>http://www.52shidai.com/javascript/jquery/573.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/573.html#comments</comments>
		<pubDate>Thu, 22 Jul 2010 05:56:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[广告效果]]></category>
		<category><![CDATA[拉幕]]></category>
		<category><![CDATA[横幅]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=573</guid>
		<description><![CDATA[基于jQuery实现，伸缩前，广告图片尺寸：980&#215;400；伸缩后，广告图片尺寸：980&#215;80。替换对应图片即可！ &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=utf-8&#34; /&#62; &#60;title&#62;基于jQuery的拉幕横幅广告效果 - 时代前端52shidai.com&#60;/title&#62; &#60;meta name=&#34;Copyright&#34; content=&#34;JavaScript分享网 http://www.52shidai.com/&#34; /&#62; &#60;meta name=&#34;description&#34; content=&#34;基于jQuery的拉幕横幅广告效果,JavaScript分享网&#34; /&#62; &#60;meta content=&#34;JavaScript,分享,JavaScript代码,Ajax&#34; name=&#34;keywords&#34; /&#62; &#60;style type=&#34;text/css&#34;&#62; img{border:0} &#60;/style&#62; &#60;SCRIPT src=&#34;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&#34; type=text/javascript&#62;&#60;/SCRIPT&#62; &#60;/head&#62; &#60;body style=&#34;text-align:center&#34;&#62; &#60;SCRIPT language=javascript type=text/javascript &#62; // JScript 文件 function TopAd() { var strTopAd=&#34;&#34;; [...]]]></description>
			<content:encoded><![CDATA[<p>基于jQuery实现，伸缩前，广告图片尺寸：980&#215;400；伸缩后，广告图片尺寸：980&#215;80。替换对应图片即可！</p>
<div class="runcode">
<p><textarea name="runcode" style="height:300px;width:620px;font-size:12px" class="runcode_text" id="runcode_1YVb3Y">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;基于jQuery的拉幕横幅广告效果 - 时代前端52shidai.com&lt;/title&gt;
&lt;meta name=&quot;Copyright&quot; content=&quot;JavaScript分享网 http://www.52shidai.com/&quot; /&gt;
&lt;meta name=&quot;description&quot; content=&quot;基于jQuery的拉幕横幅广告效果,JavaScript分享网&quot; /&gt;
&lt;meta content=&quot;JavaScript,分享,JavaScript代码,Ajax&quot; name=&quot;keywords&quot; /&gt;
&lt;style type=&quot;text/css&quot;&gt;
	img{border:0}
&lt;/style&gt;
&lt;SCRIPT src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; type=text/javascript&gt;&lt;/SCRIPT&gt;
&lt;/head&gt;
&lt;body style=&quot;text-align:center&quot;&gt;
&lt;SCRIPT language=javascript  type=text/javascript &gt;
// JScript 文件
function TopAd()
{
    var strTopAd=&quot;&quot;;
	//定义小图片内容
    var topSmallBanner=&quot;&lt;div&gt;&lt;a href=\&quot;http://www.52shidai.com/\&quot; target=_blank&gt;&lt;img src=\&quot;http://www.sharejs.com/code/gg/lamu/images/top_090901_s.gif\&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&quot;;
	//判断在那些页面上显示大图变小图效果，非这些地址只显示小图（或FLASH）
    if (location == &quot;http://www.52shidai.com&quot; || location == &quot;http://52shidai.com&quot; || true)
    {
		//定义大图内容
        strTopAd=&quot;&lt;div id=adimage style=\&quot;width:980px\&quot;&gt;&quot;+
                    &quot;&lt;div id=adBig&gt;&lt;a href=\&quot;http://www.52shidai.com/\&quot; &quot; +
                    &quot;target=_blank&gt;&lt;img title=2010年平湖在线首届家居建材团购会 &quot;+
                    &quot;src=\&quot;http://www.sharejs.com/code/gg/lamu/images/top_sharejs_b.jpg\&quot; &quot; +
                    &quot;border=0&gt;&lt;/A&gt;&lt;/div&gt;&quot;+
                    &quot;&lt;div id=adSmall style=\&quot;display: none\&quot;&gt;&quot;;
        //strTopAd+=  topFlash;
		strTopAd+=  topSmallBanner;
        strTopAd+=  &quot;&lt;/div&gt;&lt;/div&gt;&quot;;
    }
    else
    {
        //strTopAd+=topFlash;
		strTopAd+=  topSmallBanner;
    }
    strTopAd+=&quot;&lt;div style=\&quot;height:7px; clear:both;overflow:hidden\&quot;&gt;&lt;/div&gt;&quot;;
    return strTopAd;
}
document.write(TopAd());
$(function(){
	//过两秒显示 showImage(); 内容
    setTimeout(&quot;showImage();&quot;,2000);
    //alert(location);
});
function showImage()
{
    $(&quot;#adBig&quot;).slideUp(1000,function(){$(&quot;#adSmall&quot;).slideDown(1000);});
}
&lt;/SCRIPT&gt;
&lt;br&gt;&lt;br&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;br&gt;
无效果请刷新即可看到效果！
&lt;br&gt;
获取更多JavaScript代码，请登录&lt;strong&gt;时代前端&lt;/strong&gt; &lt;a href=&quot;http://www.52shidai.com&quot;&gt;http://www.52shidai.com&lt;/a&gt;
&lt;br&gt;
转载请注明出处，本代码仅供学习交流，不可用于任何商业用途！
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_1YVb3Y');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_1YVb3Y');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_1YVb3Y','runcode_1YVb3Y');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<h2  class="related_post_title">随机日志推荐</h2><ul class="related_post"></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/573.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jQuery中的mouseenter和mouseleave事件</title>
		<link>http://www.52shidai.com/javascript/jquery/558.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/558.html#comments</comments>
		<pubDate>Fri, 09 Jul 2010 11:10:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[mouseenter]]></category>
		<category><![CDATA[mouseleave]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=558</guid>
		<description><![CDATA[今天做一个下拉菜单的时候碰到了一个bug，用mouseout的时候，鼠标还没移出拉菜单就自动关闭了， 看案例：http://www.css88.com/demo/mouseleave/2.html 经过几番查阅发现了jQuery中还有mouseenter和mouseleave事件，这两个事件在手册中找不到，所以特地查阅了一番。 大家知道事件的冒泡特性，在上面的BUG中也正是因为这个冒泡特性，对于mouseover事件来说 ，当鼠标从其他元素 移动到 child节点时发生，但此事件会冒泡 所以会导致 parent 也出发mouseover。如果我们对 parent注册了 mouseover监听，从 parent移动到child 同样出发parent的mouseover 有时候我们不希望这样的事情发生。 对于 mouseover 和mouseenter 两个事件 最大的区别就是 mouseenter 是 不冒泡的事件，这时候 如果注册的监听 是mouseenter的话 无论鼠标从任何元素 移动到child时 只有child元素 发生mouseenter事件 而其祖宗节点 都不会因为冒泡 而触发此事件。 对于 mouseout 和mouseleave 也是如此 当鼠标从child 移出时 mouseout同样会冒泡到 parent 从而触发parent的 mouseout 二mouseleave 同样无此问题。 看demo：http://www.css88.com/demo/mouseleave/1.html 您可能感兴趣的文章jQ.Mobi—针对移动设备优化的jQueryjQuery-bind不能处理绑定hover事件9个实用jQuery日历插件jQuery 操作css 设置样式JQUERY操作XML实例教程不要滥用jQuery的$(this)编写高性能的jQuery代码流动导航菜单-Fluid Navigation 使用Jquery+CSS创建高亮显示文本中重要关键字（Jquery ）12个用jQuery插件改变Button按钮的漂亮特效]]></description>
			<content:encoded><![CDATA[<p>今天做一个下拉菜单的时候碰到了一个bug，用mouseout的时候，鼠标还没移出拉菜单就自动关闭了，<br />
看案例：<a href="http://www.css88.com/demo/mouseleave/2.html" target="_blank">http://www.css88.com/demo/mouseleave/2.html</a></p>
<p>经过几番查阅发现了<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>中还有<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/mouseenter" title="查看 mouseenter 中的全部文章" target="_blank">mouseenter</a></span>和<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/mouseleave" title="查看 mouseleave 中的全部文章" target="_blank">mouseleave</a></span>事件，这两个事件在手册中找不到，所以特地查阅了一番。</p>
<p>大家知道事件的冒泡特性，在上面的BUG中也正是因为这个冒泡特性，对于mouseover事件来说 ，当鼠标从其他元素 移动到 child节点时发生，但此事件会冒泡 所以会导致 parent 也出发mouseover。如果我们对 parent注册了 mouseover监听，从 parent移动到child 同样出发parent的mouseover 有时候我们不希望这样的事情发生。</p>
<p>对于 mouseover 和<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/mouseenter" title="查看 mouseenter 中的全部文章" target="_blank">mouseenter</a></span> 两个事件 最大的区别就是 mouseenter 是 不冒泡的事件，这时候 如果注册的监听 是mouseenter的话 无论鼠标从任何元素 移动到child时 只有child元素 发生mouseenter事件 而其祖宗节点 都不会因为冒泡 而触发此事件。</p>
<p>对于 mouseout 和<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/mouseleave" title="查看 mouseleave 中的全部文章" target="_blank">mouseleave</a></span> 也是如此 当鼠标从child 移出时 mouseout同样会冒泡到 parent 从而触发parent的 mouseout 二mouseleave 同样无此问题。</p>
<p>看demo：<a href="http://www.css88.com/demo/mouseleave/1.html" target="_blank">http://www.css88.com/demo/mouseleave/1.html</a></p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/558.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</title>
		<link>http://www.52shidai.com/javascript/jquery/551.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/551.html#comments</comments>
		<pubDate>Thu, 01 Jul 2010 09:52:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Fluid Navigation]]></category>
		<category><![CDATA[导航菜单]]></category>
		<category><![CDATA[流动]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=551</guid>
		<description><![CDATA[有时，一个网站的导航菜单文字不能提供足够的信息，来表达当前菜单按钮的内容，一般的解决办法是使用提示信息ToolTip，那么本文介绍的流动导航菜单Fluid Navigation也可以解决此问题，同时也为网站设计的添加了一些时尚而又动感元素。那么我们应该如何实现流动导航菜单呢？ 一、效果图 鼠标滑过Menu，即Show提示信息。     二、实现步骤 1、CSS代码 menuBarHolder { width: 730px; height:45px; background-color:#000; color:#fff; font-family:Arial; font-size:14px; margin-top:20px;} #menuBarHolder ul{ list-style-type:none; display:block;} #container { margin-top:100px;} #menuBar li{ float:left; padding:15px; height:16px; width:50px; border-right:1px solid #ccc; } #menuBar li a{color:#fff; text-decoration:none; letter-spacing:-1px; font-weight:bold;} .menuHover { background-color:#999;} .firstchild { border-left:1px solid #ccc;} .menuInfo { cursor:hand; background-color:#000; color:#fff; width:74px; font-size:11px;height:100px; padding:3px; [...]]]></description>
			<content:encoded><![CDATA[<div>有时，一个网站的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e5%af%bc%e8%88%aa%e8%8f%9c%e5%8d%95" title="查看 导航菜单 中的全部文章" target="_blank">导航菜单</a></span>文字不能提供足够的信息，来表达当前菜单按钮的内容，一般的解决办法是使用提示信息ToolTip，那么本文介绍的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%b5%81%e5%8a%a8" title="查看 流动 中的全部文章" target="_blank">流动</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e5%af%bc%e8%88%aa%e8%8f%9c%e5%8d%95" title="查看 导航菜单 中的全部文章" target="_blank">导航菜单</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/fluid-navigation" title="查看 Fluid Navigation 中的全部文章" target="_blank">Fluid Navigation</a></span>也可以解决此问题，同时也为网站设计的添加了一些时尚而又动感元素。那么我们应该如何实现<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%b5%81%e5%8a%a8" title="查看 流动 中的全部文章" target="_blank">流动</a></span>导航菜单呢？</div>
<div><strong><span style="font-size: large;">一、效果图</span></strong></div>
<div><a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.html" target="_blank"><img onclick="window.open(&quot;http://blog.51cto.com/viewpic.php?refimg=&quot; + this.src)" src="http://images.cnblogs.com/cnblogs_com/ywqu/Jquery/Jquery%20CSS%20Menu/image11.jpg" border="0" alt="" width="566" height="314" /></a></div>
<div>鼠标滑过Menu，即Show提示信息。</div>
<div> </div>
<div> </div>
<div><strong><span style="font-size: large;">二、实现步骤</span></strong></div>
<div><strong></strong></div>
<div><strong><span style="font-size: medium;">1、CSS代码</span></strong></div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="568" valign="top">
<div>menuBarHolder { <strong>width</strong>: 730px; <strong>height</strong>:45px; <strong>background-color</strong>:#000; <strong>color</strong>:#fff; <strong>font-family</strong>:Arial; <strong>font-size</strong>:14px; <strong>margin-top</strong>:20px;}</div>
<div>#menuBarHolder ul{ <strong>list-style-type</strong>:none; <strong>display</strong>:block;}</div>
<div>#container { <strong>margin-top</strong>:100px;}</div>
<div>#menuBar li{ <strong>float</strong>:<strong>left</strong>; <strong>padding</strong>:15px; <strong>height</strong>:16px; <strong>width</strong>:50px; <strong>border-right</strong>:1px solid #ccc; }</div>
<div>#menuBar li a{<strong>color</strong>:#fff; <strong>text-decoration</strong>:none; <strong>letter-spacing</strong>:-1px; <strong>font-weight</strong>:bold;}</div>
<div>.menuHover { <strong>background-color</strong>:#999;}</div>
<div>.firstchild { <strong>border-left</strong>:1px solid #ccc;}</div>
<div>.menuInfo { <strong>cursor</strong>:hand; <strong>background-color</strong>:#000; <strong>color</strong>:#fff;</div>
<div><strong>width</strong>:74px; <strong>font-size</strong>:11px;height:100px; <strong>padding</strong>:3px; <strong>display</strong>:none;</div>
<div><strong>position</strong>:absolute; <strong>margin-left</strong>:-15px; <strong>margin-top</strong>:-15px;</div>
<div>-moz-border-radius-bottomright: 5px;</div>
<div>-moz-border-radius-bottomleft: 5px;</div>
<div>-webkit-border-bottom-left-radius: 5px;</div>
<div>-webkit-border-bottom-right-radius: 5px;</div>
<div>-khtml-border-radius-bottomright: 5px;</div>
<div>-khtml-border-radius-bottomleft: 5px;</div>
<div> border-radius-bottomright: 5px;</div>
<div>border-radius-bottomleft: 5px;</div>
<div>}</div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<div>menuBarHolder: 菜单Menu的固定容器，宽度=730px。</div>
<div>menuInfo：控制提示信息的展示与否。</div>
<div> </div>
<div><strong><span style="font-size: medium;">2、HTML代码</span></strong></div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="568" valign="top">&lt;<strong>div</strong>id=”menuBarHolder”&gt;</p>
<p>&lt;<strong>ul</strong>id=”menuBar”&gt;</p>
<pre>&lt;<strong>li</strong>class="firstchild"&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Home&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the home section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Services&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the services section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Clients&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the clients section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Portfolio&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the portfolio section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;About&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the about section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Blog&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the blog section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Follow&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the follow section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;<strong>li</strong>&gt;&lt;<strong>a</strong>href="javascript:#"&gt;Contact&lt;/<strong>a</strong>&gt;</pre>
<pre>&lt;<strong>div</strong>class="menuInfo"&gt;I am some text about the contact section&lt;/<strong>div</strong>&gt;&lt;/<strong>li</strong>&gt;</pre>
<pre>&lt;/<strong>ul</strong>&gt;</pre>
<pre>&lt;/<strong>div</strong>&gt;</pre>
<pre>&lt;/<strong>div</strong>&gt;</pre>
</td>
</tr>
</tbody>
</table>
<div> </div>
<div> </div>
<div>UI LI元素：列表元素。</div>
<div>DIV元素：提示内容信息。</div>
<div><strong><span style="font-size: medium;">3、Javascript代码</span></strong></div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="568" valign="top">$(document).ready(<strong>function</strong>()</p>
<pre> </pre>
<pre>{</pre>
<pre>$('#menuBar li').click(<strong>function</strong>()</pre>
<pre>{</pre>
<pre> <strong>var</strong> url = $(<strong>this</strong>).find('a').attr('href');</pre>
<pre> document.location.href = url;</pre>
<pre>});</pre>
<pre>$('#menuBar li').hover(<strong>function</strong>()</pre>
<pre>{</pre>
<pre>   $(<strong>this</strong>).find('.menuInfo').slideDown();</pre>
<pre>},</pre>
<pre><strong>function</strong>()</pre>
<pre>{</pre>
<pre> $(<strong>this</strong>).find('.menuInfo').slideUp();</pre>
<pre>});</pre>
<pre>});</pre>
</td>
</tr>
</tbody>
</table>
<div> </div>
<div> </div>
<div>click()、 hover():给Li元素绑定单击事件和鼠标滑过事件。</div>
<div>find()函数：搜索所有与指定表达式匹配的元素。这个函数是找出正在处理的元素的后代元素的好方法。</div>
<div>slideDown(speed, <em>[callback]</em>)：通过高度变化（向下增大）来动态地显示所有匹配的元素，在显示完成后可选地触发一个回调函数。</div>
<div>slideUp(speed, <em>[callback]</em>)：通过高度变化（向上减小）来动态地隐藏所有匹配的元素，在隐藏完成后可选地触发一个回调函数。</div>
<div> </div>
<div>演示地址：<a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.html" target="_blank"><span style="color: #000000;">http://addyosmani.com/resources/fluid-menu/fluid-menu.html</span></a></div>
<div>下载地址：<a href="http://addyosmani.com/resources/fluid-menu/fluid-menu.zip" target="_blank"><span style="color: #000000;">http://addyosmani.com/resources/fluid-menu/fluid-menu.zip</span></a></div>
<div>参考英文：</div>
<div>http://addyosmani.com/blog/fluid-navigation-how-to-create-an-informative-menu-bar-with-jquery-in-just-a-few-minutes/#myPosts</div>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/551.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>高亮显示文本中重要关键字（Jquery ）</title>
		<link>http://www.52shidai.com/javascript/jquery/549.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/549.html#comments</comments>
		<pubDate>Thu, 01 Jul 2010 09:47:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[显示]]></category>
		<category><![CDATA[高亮]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=549</guid>
		<description><![CDATA[一、界面预览     鼠标放到右边的Tab按钮上，文字透明度降低，同时一段文字高亮显示，效果如下：     Demo地址：http://5thirtyone.com/sandbox/samples/fadefocus/   很绚丽的效果幺！ 二、实现原理     将要高亮显示的文字加上&#60;span&#62;段落标记， class=”mask”的div 做为遮罩层，使此遮罩层位于文字内容之上（z-index属性，使用Jquery给段落动态添加样式类。   三、HTML代码 &#60;div class=”wrapper”&#62;     &#60;ul&#62;         &#60;li&#62;&#60;a href=”#”&#62;Summary&#60;/a&#62;&#60;/li&#62;         &#60;li&#62;&#60;a href=”#”&#62;Avatar&#60;/a&#62;&#60;/li&#62;         &#60;li&#62;&#60;a href=”#”&#62;Formats&#60;/a&#62;&#60;/li&#62;     &#60;/ul&#62;     &#60;div&#62;         &#60;h2&#62;             Avatar (2009 film)&#60;/h2&#62;         &#60;div&#62;             &#60;img src=”images/avatar.jpg” alt=”Avatar poster” /&#62;             &#60;p&#62;                 Avatar, also known as [...]]]></description>
			<content:encoded><![CDATA[<div><strong><span style="font-size: large;">一、界面预览</span></strong></div>
<div> </div>
<div><img onclick="window.open(&quot;http://blog.51cto.com/viewpic.php?refimg=&quot; + this.src)" src="http://images.cnblogs.com/cnblogs_com/ywqu/UI/jQueryHighlightimportantkeyword%20insidetext/001.gif" border="0" alt="" width="558" height="498" /></div>
<div>  鼠标放到右边的Tab按钮上，文字透明度降低，同时一段文字<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e9%ab%98%e4%ba%ae" title="查看 高亮 中的全部文章" target="_blank">高亮</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%98%be%e7%a4%ba" title="查看 显示 中的全部文章" target="_blank">显示</a></span>，效果如下：</div>
<div><img onclick="window.open(&quot;http://blog.51cto.com/viewpic.php?refimg=&quot; + this.src)" src="http://images.cnblogs.com/cnblogs_com/ywqu/UI/jQueryHighlightimportantkeyword%20insidetext/002.gif" border="0" alt="" width="527" height="471" /></div>
<div> </div>
<div>  Demo地址：<a href="http://5thirtyone.com/sandbox/samples/fadefocus/" target="_blank"><span style="color: #800080;">http://5thirtyone.com/sandbox/samples/fadefocus/</span></a></div>
<div>  很绚丽的效果幺！</div>
<div><strong><span style="font-size: large;">二、实现原理</span></strong></div>
<div> </div>
<div>  将要<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e9%ab%98%e4%ba%ae" title="查看 高亮 中的全部文章" target="_blank">高亮</a></span><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%98%be%e7%a4%ba" title="查看 显示 中的全部文章" target="_blank">显示</a></span>的文字加上&lt;span&gt;段落标记， class=”mask”的div 做为遮罩层，使此遮罩层位于文字内容之上（z-index属性，使用Jquery给段落动态添加样式类。</div>
<div> </div>
<div><strong><span style="font-size: large;">三、HTML代码</span></strong></div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="568" valign="top">
<div>&lt;div class=”wrapper”&gt;</div>
<div>    &lt;ul&gt;</div>
<div>        &lt;li&gt;&lt;a href=”#”&gt;Summary&lt;/a&gt;&lt;/li&gt;</div>
<div>        &lt;li&gt;&lt;a href=”#”&gt;Avatar&lt;/a&gt;&lt;/li&gt;</div>
<div>        &lt;li&gt;&lt;a href=”#”&gt;Formats&lt;/a&gt;&lt;/li&gt;</div>
<div>    &lt;/ul&gt;</div>
<div>    &lt;div&gt;</div>
<div>        &lt;h2&gt;</div>
<div>            Avatar (2009 film)&lt;/h2&gt;</div>
<div>        &lt;div&gt;</div>
<div>            &lt;img src=”images/avatar.jpg” alt=”Avatar poster” /&gt;</div>
<div>            &lt;p&gt;</div>
<div>                Avatar, also known as James Cameron&#8217;s Avatar, is an American 3-D science fiction</div>
<div>                epic film written and directed by &lt;a href=”http://en.wikipedia.org/wiki/James_Cameron”&gt;</div>
<div>                    James Cameron&lt;/a&gt;, and was released on December 16, 2009 by 20th Century Fox.</div>
<div>                The film is co-produced by &lt;a href=”http://en.wikipedia.org/wiki/Lightstorm_Entertainment”&gt;</div>
<div>                    Lightstorm Entertainment&lt;/a&gt;, and &lt;span&gt;focuses on an epic conflict on Pandora&lt;/span&gt;,</div>
<div>                an inhabited Earth-sized moon of Polyphemus, one of three fictional gas giants orbiting</div>
<div>                &lt;a href=”http://en.wikipedia.org/wiki/Alpha_Centauri_A”&gt;Alpha Centauri A&lt;/a&gt;. On</div>
<div>                Pandora, human colonists and the sentient humanoid indigenous inhabitants of Pandora,</div>
<div>                the Na&#8217;vi, engage in a war over the planet&#8217;s resources and the latter&#8217;s continued</div>
<div>                existence. The film&#8217;s title refers to &lt;span&gt;an avatar, a representation of</div>
<div>                    a real person in a virtual world&lt;/span&gt;.&lt;/p&gt;</div>
<div>            &lt;p&gt;</div>
<div>                &lt;span&gt;The film was released in 2D and 3D formats&lt;/span&gt;, along with an</div>
<div>                IMAX 3D release in selected theaters. The film is being touted as a breakthrough</div>
<div>                in terms of filmmaking technology, for its development of 3D viewing and stereoscopic</div>
<div>                filmmaking with cameras that were specially designed for the film&#8217;s production.&lt;/p&gt;</div>
<div>            &lt;p&gt;</div>
<div>                Read the rest of the &lt;a href=”http://en.wikipedia.org/wiki/Avatar_(2009_film)”&gt;original</div>
<div>                    Wikipedia page about Avatar&lt;/a&gt;&lt;/p&gt;</div>
<div>            &lt;div&gt;</div>
<div>            &lt;/div&gt;</div>
<div>        &lt;/div&gt;</div>
<div>    &lt;/div&gt;</div>
<div>&lt;/div&gt;</div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<div>entity-results类中显示了Tab按钮，每个按钮控制左边文字的透明度，段落文字的<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e9%ab%98%e4%ba%ae" title="查看 高亮 中的全部文章" target="_blank">高亮</a></span>显示。</div>
<div>entity-source类中有三个段落span Calss分别为 d1 d2 d3，也就是高亮文字段落。</div>
<div>class=”mask”的空div放到最后，此Div也就是一个遮罩层。</div>
<div><strong><span style="font-size: large;">四、CSS关键代码</span></strong></div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="568" valign="top">
<div>.entity-source, .entity-source span.show</div>
<div>{</div>
<div>    position: relative;</div>
<div>}</div>
<div>.entity-source .mask</div>
<div>{</div>
<div>    display: none;</div>
<div>    position: absolute;</div>
<div>    top: 0;</div>
<div>    left: 0;</div>
<div>    height: 100%;</div>
<div>    width: 100%;</div>
<div>    z-index: 1;</div>
<div>}</div>
<div>.entity-source span</div>
<div>{</div>
<div>    z-index: 2;</div>
<div>}</div>
<div>.entity-source span.show</div>
<div>{</div>
<div>    background: #ffc;</div>
<div>    color: #000;</div>
<div>}</div>
<div> </div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<div>类mask中的z-index:1 使得&lt;div class=”mask”&gt; 覆盖在左边文字内容之上。</div>
<div>z-nidex：2又使得span段落覆盖在&lt;div class=”mask”&gt;之上。从而显示实现了段落文字高亮显示。</div>
<div><strong><span style="font-size: large;">五、Jquery代码</span></strong></div>
<div> </div>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="568" valign="top">
<div><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>(document).ready(function($) {</div>
<div>    // mask source 控制mask的动画效果</div>
<div>    var maskSource = <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>(&#8216;.mask&#8217;);</div>
<div>    jQuery(&#8216;.entity-results&#8217;).hover(function() {</div>
<div>        maskSource.animate({opacity:0.7},1).fadeIn(&#8217;750&#8242;);</div>
<div>    }, function() {</div>
<div>        maskSource.fadeOut(&#8217;1000&#8242;);</div>
<div>    });</div>
<div> </div>
<div>    // match hover 控制段落的高亮显示</div>
<div>    var sample1 = jQuery(&#8216;span.d1&#8242;);</div>
<div>    var sample2 = jQuery(&#8216;span.d2&#8242;);</div>
<div>    var sample3 = jQuery(&#8216;span.d3&#8242;);</div>
<div>    jQuery(&#8216;a.d1&#8242;).hover(function() {</div>
<div>        sample1.addClass(&#8216;show&#8217;);   //给段落添加类</div>
<div>    }, function() {</div>
<div>        sample1.removeClass(&#8216;show&#8217;); //移除段落类</div>
<div>    });</div>
<div>    jQuery(&#8216;a.d2&#8242;).hover(function() {</div>
<div>        sample2.addClass(&#8216;show&#8217;);</div>
<div>    }, function() {</div>
<div>        sample2.removeClass(&#8216;show&#8217;);</div>
<div>    });</div>
<div>    jQuery(&#8216;a.d3&#8242;).hover(function() {</div>
<div>        sample3.addClass(&#8216;show&#8217;);</div>
<div>    }, function() {</div>
<div>        sample3.removeClass(&#8216;show&#8217;);</div>
<div>    });</div>
<div>});</div>
</td>
</tr>
</tbody>
</table>
<div> </div>
<div><strong>动画函数</strong><strong>animate(params, [duration], [easing], [callback]) </strong></div>
<div>Params：一组包含作为动画属性和终值的样式属性和及其值的集合</div>
<div><strong>duration</strong><em> (</em><em>可选</em><em>)</em><em>：</em>种预定速度之一的字符串(“slow”, “normal”, or “fast”)或表示动画时长的毫秒数值(如：1000)</div>
<div><strong>easing</strong><em> (</em><em>可选</em><em>)</em><em>：</em>要使用的擦除效果的名称(需要插件支持).默认jQuery提供”linear” 和 “swing”.</div>
<div><strong>callback</strong><em> (</em><em>可选)</em><em>：</em>在动画完成时执行的函数</div>
<div> </div>
<div><strong>淡入效果函数：</strong><strong>fadeIn(speed, [callback])</strong></div>
<div>Speed：三种预定速度之一的字符串(“slow”, “normal”, or “fast”)或表示动画时长的毫秒数值(如：1000)</div>
<div>callback (可选)：(Optional) 在动画完成时执行的函数</div>
<div> </div>
<div><strong> 淡出效果函数：<span style="font-size: x-small;">fadeOut解释同fadeIn</span></strong></div>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/546.html" title="12个用jQuery插件改变Button按钮的漂亮特效">12个用jQuery插件改变Button按钮的漂亮特效</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/549.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>12个用jQuery插件改变Button按钮的漂亮特效</title>
		<link>http://www.52shidai.com/javascript/jquery/546.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/546.html#comments</comments>
		<pubDate>Tue, 29 Jun 2010 15:34:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[特效]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=546</guid>
		<description><![CDATA[jQuery已经被广泛的应用于网页制作当中，今天介绍给大家的主要集中在button按钮上面，一个优秀的按钮，动态效果或者一些Tip提示，或者一个图层透明度为50%，以及CSS3+jQuery效果等，都是一个很精典的设计，一起分享分们吧。 How to create Skype-like buttons using jQuery Demo and Download Creative Button Animations with Sprites and JQuery Demo and Download Scalable css buttons using png and background colors Demo and Download Simple Accordion w/ CSS and jQuery Demo and Download Make Fancy Light Up RSS Button With JQuery Fading Demo and Download Pretty checkboxes [...]]]></description>
			<content:encoded><![CDATA[<h2><img src="http://m4png.m4go.com/usr/uploads/2010/05/22/bubbleup-jquery-plugin.png" alt="" /></h2>
<div>
<p><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>已经被广泛的应用于网页制作当中，今天介绍给大家的主要集中在<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/button" title="查看 button 中的全部文章" target="_blank">button</a></span>按钮上面，一个优秀的按钮，动态效果或者一些Tip提示，或者一个图层透明度为50%，以及CSS3+<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>效果等，都是一个很精典的设计，一起分享分们吧。</p>
<p><img title="skype_buttons" src="http://m4png.m4go.com/usr/uploads/2010/05/22/skype_buttons.png" alt="" width="620" height="318" /></p>
<p>How to create Skype-like <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/button" title="查看 button 中的全部文章" target="_blank">button</a></span>s using <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span></p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/03/11/How-to-create-Skype-like-buttons-using-jQuery.aspx" target="_blank">Demo and Download</a></p>
<p><img title="button-sprites" src="http://m4png.m4go.com/usr/uploads/2010/05/22/button-sprites.png" alt="" width="620" height="318" /></p>
<p>Creative Button Animations with Sprites and JQuery</p>
<p><a href="http://www.tutorial9.net/web-tutorials/creative-button-animations-with-sprites-and-jquery-part-2/" target="_blank">Demo and Download</a></p>
<p><img title="CSS-Buttons-demo" src="http://m4png.m4go.com/usr/uploads/2010/05/22/CSS-Buttons-demo.png" alt="" width="620" height="318" /></p>
<p>Scalable css <span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/button" title="查看 button 中的全部文章" target="_blank">button</a></span>s using png and background colors</p>
<p><a href="http://monc.se/kitchen/59/scalable-css-buttons-using-png-and-background-colors" target="_blank">Demo and Download</a></p>
<p><img title="Simple-Accordion" src="http://m4png.m4go.com/usr/uploads/2010/05/22/Simple-Accordion.png" alt="" width="620" height="318" /></p>
<p>Simple Accordion w/ CSS and jQuery</p>
<p><a href="http://www.sohtanaka.com/web-design/simple-accordion-w-css-and-jquery/" target="_blank">Demo and Download</a></p>
<p><img title="rss" src="http://m4png.m4go.com/usr/uploads/2010/05/22/rss.png" alt="" width="620" height="318" /></p>
<p>Make Fancy Light Up RSS Button With JQuery Fading</p>
<p><a href="http://design-notes.info/tutorial/jquery-tutorial/make-fancy-light-up-rss-button-with-jquery-fading/" target="_blank">Demo and Download</a></p>
<p><img title="Pretty-checkboxes" src="http://m4png.m4go.com/usr/uploads/2010/05/22/Pretty-checkboxes.png" alt="" width="620" height="318" /></p>
<p>Pretty checkboxes with jQuery</p>
<p><a href="http://aaronweyenberg.com/90/pretty-checkboxes-with-jquery" target="_blank">Demo and Download</a></p>
<p><img title="bubbleup-jquery-plugin" src="http://m4png.m4go.com/usr/uploads/2010/05/22/bubbleup-jquery-plugin.png" alt="" width="620" height="318" /></p>
<p>BubbleUp jQuery Plugin to Spice Up Your Menu</p>
<p><a href="http://aext.net/2010/04/bubbleup-jquery-plugin/" target="_blank">Demo and Download</a></p>
<p><img title="Toolkit-Example" src="http://m4png.m4go.com/usr/uploads/2010/05/22/Toolkit-Example.png" alt="" width="620" height="318" /></p>
<p>Create Twitter-Style Buttons with the Dojo Toolkit</p>
<p><a href="http://davidwalsh.name/dojo-twitter" target="_blank">Demo and Download</a></p>
<p><img title="Realistic-Hover-Effect-With-jQuery" src="http://m4png.m4go.com/usr/uploads/2010/05/22/Realistic-Hover-Effect-With-jQuery.png" alt="" width="620" height="318" /></p>
<p>Create a Realistic Hover Effect With jQuery</p>
<p><a href="http://www.adrianpelletier.com/2009/05/31/create-a-realistic-hover-effect-with-jquery-ui/" target="_blank">Demo and Download</a></p>
<p><img title="CSS3-And-jQuery" src="http://m4png.m4go.com/usr/uploads/2010/05/22/CSS3-And-jQuery.png" alt="" width="620" height="318" /></p>
<p>Nice And Simple Toolbar For Your Website With CSS3 And jQuery</p>
<p><a href="http://www.pvmgarage.com/2009/12/nice-and-simple-toolbar-for-your-website-with-css3-and-jquery/" target="_blank">Demo and Download</a></p>
<p><img title="Tooltips-Menu-Tutorials" src="http://m4png.m4go.com/usr/uploads/2010/05/22/Tooltips-Menu-Tutorials.png" alt="" width="620" height="318" /></p>
<p>jQuery Horizontal Tooltips Menu Tutorials</p>
<p><a href="http://www.queness.com/post/556/jquery-horizontal-tooltips-menu-tutorials" target="_blank">Demo and Download</a></p>
<p><img title="menu-with-CSS3" src="http://m4png.m4go.com/usr/uploads/2010/05/22/menu-with-CSS3.png" alt="" width="620" height="318" /></p>
<p>Query style menu with CSS3</p>
<p><a href="http://www.tobypitman.com/jquery-style-menu-with-css3/" target="_blank">Demo and Download</a></p>
</div>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/551.html" title="流动导航菜单-Fluid Navigation 使用Jquery+CSS创建">流动导航菜单-Fluid Navigation 使用Jquery+CSS创建</a></li><li><a href="http://www.52shidai.com/javascript/jquery/549.html" title="高亮显示文本中重要关键字（Jquery ）">高亮显示文本中重要关键字（Jquery ）</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/546.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用jquery实现整站链接弹出新页面</title>
		<link>http://www.52shidai.com/javascript/jquery/470.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/470.html#comments</comments>
		<pubDate>Sat, 15 May 2010 04:58:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[弹出]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=470</guid>
		<description><![CDATA[在做网页的时候有没有碰到过，切好页面以后，做的时候偷电小懒，没加上 target:=”_blank”，做好以后又想让全部连接都弹出新页面，这还好说，要是程序也套好了，再想加上怎么办？作为一个挨踢人都是很懒的，一个一个加上，太麻烦了。时代前端就碰到过，在这里记录起来好了。 那就偷个懒，用一段小的jquery来实现吧。 &#60;script type=”text/javascript”&#62; $(document).ready(function(){ $(“a”).attr(“target”, “_blank”); }); &#60;/script&#62;   当然在加上上面代码以前不要忘了先把jquery文件引入页面。 如果只是想在某个区域里的链接都弹出来，就在那个区域加上总的class，比如加上class名为 “chia”。代码可以这么写： &#60;script type=”text/javascript”&#62; $(document).ready(function(){ $(“.chia  a”).attr(“target”, “_blank”); }); &#60;/script&#62; 您可能感兴趣的文章jQ.Mobi—针对移动设备优化的jQueryjQuery-bind不能处理绑定hover事件9个实用jQuery日历插件去除链接的虚线框方法及用户体验的影响jQuery 操作css 设置样式JQUERY操作XML实例教程发外链时需要注意的地方不要滥用jQuery的$(this)编写高性能的jQuery代码jQuery中的mouseenter和mouseleave事件]]></description>
			<content:encoded><![CDATA[<p>在做网页的时候有没有碰到过，切好页面以后，做的时候偷电小懒，没加上 <em>target:=”_blank”，</em>做好以后又想让全部连接都<em><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e5%bc%b9%e5%87%ba" title="查看 弹出 中的全部文章" target="_blank">弹出</a></span>新页面</em>，这还好说，要是程序也套好了，再想加上怎么办？作为一个<em>挨踢人</em>都是很懒的，一个一个加上，太麻烦了。<a href="http://www.52shidai.com/" target="_blank">时代前端</a>就碰到过，在这里记录起来好了。</p>
<p>那就偷个懒，用一段小的jquery来实现吧。</p>
<p><span style="color: #ff6600;">&lt;script type=”text/javascript”&gt;<br />
$(document).ready(function(){<br />
$(“a”).attr(“target”, “_blank”);<br />
});<br />
&lt;/script&gt;</span><br />
 </p>
<p>当然在加上上面代码以前不要忘了先把jquery文件引入页面。</p>
<p>如果只是想在某个区域里的<em><span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e9%93%be%e6%8e%a5" title="查看 链接 中的全部文章" target="_blank">链接</a></span>都<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e5%bc%b9%e5%87%ba" title="查看 弹出 中的全部文章" target="_blank">弹出</a></span>来</em>，就在那个区域加上总的class，比如加上class名为 “chia”。代码可以这么写：</p>
<p><span style="color: #ff6600;">&lt;script type=”text/javascript”&gt;<br />
$(document).ready(function(){<br />
$(“.chia  a”).attr(“target”, “_blank”);<br />
});<br />
&lt;/script&gt;</span></p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/web-front/733.html" title="去除链接的虚线框方法及用户体验的影响">去除链接的虚线框方法及用户体验的影响</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/seo/664.html" title="发外链时需要注意的地方">发外链时需要注意的地方</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/javascript/jquery/558.html" title="jQuery中的mouseenter和mouseleave事件">jQuery中的mouseenter和mouseleave事件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/470.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jquery技巧总结大放送</title>
		<link>http://www.52shidai.com/javascript/jquery/455.html</link>
		<comments>http://www.52shidai.com/javascript/jquery/455.html#comments</comments>
		<pubDate>Thu, 06 May 2010 05:52:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[技巧]]></category>

		<guid isPermaLink="false">http://www.52shidai.com/?p=455</guid>
		<description><![CDATA[一、简介 1.1、概述 随着WEB2.0及ajax思想在互联网上的快速发展传播，陆续出现了一些优秀的Js框架，其中比较著名的有Prototype、YUI、jQuery、mootools、Bindows以及国内的JSVM框架等，通过将这些JS框架应用到我们的项目中能够使程序员从设计和书写繁杂的JS应用中解脱出来，将关注点转向功能需求而非实现细节上，从而提高项目的开发速度。 jQuery是继prototype之后的又一个优秀的Javascript框架。它是由 John Resig 于 2006 年初创建的，它有助于简化 JavaScript™ 以及Ajax 编程。有人使用这样的一比喻来比较prototype和jQuery：prototype就像Java，而jQuery就像ruby. 它是一个简洁快速灵活的JavaScript框架，它能让你在你的网页上简单的操作文档、处理事件、实现特效并为Web页面添加Ajax交互。 它具有如下一些特点： 1、代码简练、语义易懂、学习快速、文档丰富。 2、jQuery是一个轻量级的脚本，其代码非常小巧，最新版的JavaScript包只有20K左右。 3、jQuery支持CSS1-CSS3,以及基本的xPath。 4、jQuery是跨浏览器的，它支持的浏览器包括IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+。 5、可以很容易的为jQuery扩展其他功能。 6、能将JS代码和HTML代码完全分离，便于代码和维护和修改。 7、插件丰富，除了jQuery本身带有的一些特效外，可以通过插件实现更多功能，如表单验证、tab导航、拖放效果、表格排序、DataGrid，树形菜单、图像特效以及ajax上传等。 jQuery的设计会改变你写JavaScript代码的方式，降低你学习使用JS操作网页的复杂度，提高网页JS开发效率，无论对于js初学者还是资深专家，jQuery都将是您的首选。 jQuery适合于设计师、开发者以及那些还好者，同样适合用于商业开发，可以说jQuery适合任何JavaScript应用的地方，可用于不同的Web应用程序中。 官方站点：http://jquery.com/  中文站点：http://jquery.org.cn/ 1.2、目的 通过学习本文档，能够对jQuery有一个简单的认识了解，清楚JQuery与其他JS框架的不同，掌握jQuery的常用语法、使用技巧及注意事项。 二、使用方法 在需要使用JQuery的页面中引入JQuery的js文件即可。 例如：&#60;script type=”text/javascript” src=”js/jquery.js”&#62;&#60;/script&#62; 引入之后便可在页面的任意地方使用jQuery提供的语法。 三、学习教程及参考资料 请参照《jQuery中文API手册》和http://jquery.org.cn/visual/cn/index.xml 推荐两篇不错的jquery教程：《jQuery的起点教程》和《使用 jQuery 简化 Ajax 开发》 (说明：以上文档都放在了【附件】中) 四、语法总结和注意事项 1、关于页面元素的引用 通过jquery的$()引用元素包括通过id、class、元素名以及元素的层级关系及dom或者xpath条件等方法，且返回的对象为jquery对象（集合对象），不能直接调用dom定义的方法。 2、jQuery对象与dom对象的转换 只有jquery对象才能使用jquery定义的方法。注意dom对象和jquery对象是有区别的，调用方法时要注意操作的是dom对象还是jquery对象。 普通的dom对象一般可以通过$()转换成jquery对象。 如：$(document.getElementById(“msg”))则为jquery对象，可以使用jquery的方法。 [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>一、简介</em></strong></p>
<p><strong>1.1、概述</strong><br />
随着WEB2.0及ajax思想在互联网上的快速发展传播，陆续出现了一些优秀的Js框架，其中比较著名的有Prototype、YUI、<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>、mootools、Bindows以及国内的JSVM框架等，通过将这些JS框架应用到我们的项目中能够使程序员从设计和书写繁杂的JS应用中解脱出来，将关注点转向功能需求而非实现细节上，从而提高项目的开发速度。<br />
<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>是继prototype之后的又一个优秀的Javascript框架。它是由 John Resig 于 2006 年初创建的，它有助于简化 JavaScript™ 以及Ajax 编程。有人使用这样的一比喻来比较prototype和<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/jquery" title="查看 jQuery 中的全部文章" target="_blank">jQuery</a></span>：prototype就像Java，而jQuery就像ruby. 它是一个简洁快速灵活的JavaScript框架，它能让你在你的网页上简单的操作文档、处理事件、实现特效并为Web页面添加Ajax交互。</p>
<p><em>它具有如下一些特点：<br />
</em>1、代码简练、语义易懂、学习快速、文档丰富。<br />
2、jQuery是一个轻量级的脚本，其代码非常小巧，最新版的JavaScript包只有20K左右。<br />
3、jQuery支持CSS1-CSS3,以及基本的xPath。<br />
4、jQuery是跨浏览器的，它支持的浏览器包括IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+。<br />
5、可以很容易的为jQuery扩展其他功能。<br />
6、能将JS代码和HTML代码完全分离，便于代码和维护和修改。<br />
7、插件丰富，除了jQuery本身带有的一些特效外，可以通过插件实现更多功能，如表单验证、tab导航、拖放效果、表格排序、DataGrid，树形菜单、图像特效以及ajax上传等。</p>
<p>jQuery的设计会改变你写JavaScript代码的方式，降低你学习使用JS操作网页的复杂度，提高网页JS开发效率，无论对于js初学者还是资深专家，jQuery都将是您的首选。<br />
jQuery适合于设计师、开发者以及那些还好者，同样适合用于商业开发，可以说jQuery适合任何JavaScript应用的地方，可用于不同的Web应用程序中。<br />
官方站点：http://jquery.com/  中文站点：http://jquery.org.cn/</p>
<p><strong>1.2、目的</strong><br />
通过学习本文档，能够对jQuery有一个简单的认识了解，清楚JQuery与其他JS框架的不同，掌握jQuery的常用语法、使用<span class='wp_keywordlink_affiliate'><a href="http://www.52shidai.com/tag/%e6%8a%80%e5%b7%a7" title="查看 技巧 中的全部文章" target="_blank">技巧</a></span>及注意事项。</p>
<p><em><strong>二、使用方法</strong></em><br />
在需要使用JQuery的页面中引入JQuery的js文件即可。<br />
例如：&lt;script type=”text/javascript” src=”js/jquery.js”&gt;&lt;/script&gt;<br />
引入之后便可在页面的任意地方使用jQuery提供的语法。</p>
<p><strong><em>三、学习教程及参考资料</em></strong><br />
请参照《jQuery中文API手册》和http://jquery.org.cn/visual/cn/index.xml<br />
推荐两篇不错的jquery教程：《jQuery的起点教程》和《使用 jQuery 简化 Ajax 开发》<br />
(说明：以上文档都放在了【附件】中)</p>
<p><strong><em>四、语法总结和注意事项</em></strong></p>
<p><strong>1、关于页面元素的引用</strong><br />
通过jquery的$()引用元素包括通过id、class、元素名以及元素的层级关系及dom或者xpath条件等方法，且返回的对象为jquery对象（集合对象），不能直接调用dom定义的方法。</p>
<p><strong>2、jQuery对象与dom对象的转换</strong><br />
只有jquery对象才能使用jquery定义的方法。注意dom对象和jquery对象是有区别的，调用方法时要注意操作的是dom对象还是jquery对象。<br />
普通的dom对象一般可以通过$()转换成jquery对象。<br />
如：$(document.getElementById(“msg”))则为jquery对象，可以使用jquery的方法。<br />
由于jquery对象本身是一个集合。所以如果jquery对象要转换为dom对象则必须取出其中的某一项，一般可通过索引取出。<br />
如：$(“#msg”)[0]，$(“div”).eq(1)[0]，$(“div”).get()[1]，$(“td”)[5]这些都是dom对象，可以使用dom中的方法，但不能再使用Jquery的方法。<br />
以下几种写法都是正确的：<br />
$(“#msg”).html();<br />
$(“#msg”)[0].innerHTML;<br />
$(“#msg”).eq(0)[0].innerHTML;<br />
$(“#msg”).get(0).innerHTML;</p>
<p><strong>3、如何获取jQuery集合的某一项</strong><br />
对于获取的元素集合，获取其中的某一项（通过索引指定）可以使用eq或get(n)方法或者索引号获取，要注意，eq返回的是jquery对象，而get (n)和索引返回的是dom元素对象。对于jquery对象只能使用jquery的方法，而dom对象只能使用dom的方法，如要获取第三个&lt; div&gt;元素的内容。有如下两种方法：<br />
$(“div”).eq(2).html();              //调用jquery对象的方法<br />
$(“div”).get(2).innerHTML;       //调用dom的方法属性</p>
<p><strong>4、同一函数实现set和get</strong><br />
Jquery中的很多方法都是如此，主要包括如下几个：<br />
$(“#msg”).html();              //返回id为msg的元素节点的html内容。<br />
$(“#msg”).html(“&lt;b&gt;new content&lt;/b&gt;”);      <br />
//将“&lt;b&gt;new content&lt;/b&gt;” 作为html串写入id为msg的元素节点内容中,页面显示粗体的new content</p>
<p>$(“#msg”).text();              //返回id为msg的元素节点的文本内容。<br />
$(“#msg”).text(“&lt;b&gt;new content&lt;/b&gt;”);      <br />
//将“&lt;b&gt;new content&lt;/b&gt;” 作为普通文本串写入id为msg的元素节点内容中,页面显示粗体的&lt;b&gt;new content&lt;/b&gt;</p>
<p>$(“#msg”).height();              //返回id为msg的元素的高度<br />
$(“#msg”).height(“300&#8243;);       //将id为msg的元素的高度设为300<br />
$(“#msg”).width();              //返回id为msg的元素的宽度<br />
$(“#msg”).width(“300&#8243;);       //将id为msg的元素的宽度设为300</p>
<p>$(“input”).val(“);       //返回表单输入框的value值<br />
$(“input”).val(“test”);       //将表单输入框的value值设为test</p>
<p>$(“#msg”).click();       //触发id为msg的元素的单击事件<br />
$(“#msg”).click(fn);       //为id为msg的元素单击事件添加函数<br />
同样blur,focus,select,submit事件都可以有着两种调用方法</p>
<p><strong>5、集合处理功能</strong><br />
对于jquery返回的集合内容无需我们自己循环遍历并对每个对象分别做处理，jquery已经为我们提供的很方便的方法进行集合的处理。<br />
包括两种形式：<br />
$(“p”).each(function(i){this.style.color=['#f00','#0f0','#00f']})      <br />
//为索引分别为0，1，2的p元素分别设定不同的字体颜色。</p>
<p>$(“tr”).each(function(i){this.style.backgroundColor=['#ccc','#fff'][i%2]})      <br />
//实现表格的隔行换色效果</p>
<p>$(“p”).click(function(){alert($(this).html())})              <br />
//为每个p元素增加了click事件，单击某个p元素则弹出其内容</p>
<p><strong>6、扩展我们需要的功能</strong><br />
$.extend({<br />
       min: function(a, b){return a &lt; b?a:b; },<br />
       max: function(a, b){return a &gt; b?a:b; }<br />
});       //为jquery扩展了min,max两个方法<br />
使用扩展的方法（通过“$.方法名”调用）：<br />
alert(“a=10,b=20,max=”+$.max(10,20)+”,min=”+$.min(10,20));</p>
<p><strong>7、支持方法的连写</strong><br />
所谓连写，即可以对一个jquery对象连续调用各种不同的方法。<br />
例如：<br />
$(“p”).click(function(){alert($(this).html())})<br />
.mouseover(function(){alert(&#8216;mouse over event&#8217;)})<br />
.each(function(i){this.style.color=['#f00','#0f0','#00f']});</p>
<p><strong>8、操作元素的样式</strong><br />
主要包括以下几种方式：<br />
$(“#msg”).css(“background”);              //返回元素的背景颜色<br />
$(“#msg”).css(“background”,”#ccc”)       //设定元素背景为灰色<br />
$(“#msg”).height(300); $(“#msg”).width(“200&#8243;);       //设定宽高<br />
$(“#msg”).css({ color: “red”, background: “blue” });//以名值对的形式设定样式<br />
$(“#msg”).addClass(“select”);       //为元素增加名称为select的class<br />
$(“#msg”).removeClass(“select”);       //删除元素名称为select的class<br />
$(“#msg”).toggleClass(“select”);       //如果存在（不存在）就删除（添加）名称为select的class</p>
<p><strong>9、完善的事件处理功能</strong><br />
Jquery已经为我们提供了各种事件处理方法，我们无需在html元素上直接写事件，而可以直接为通过jquery获取的对象添加事件。<br />
如：<br />
$(“#msg”).click(function(){alert(“good”)})       //为元素添加了单击事件<br />
$(“p”).click(function(i){this.style.color=['#f00','#0f0','#00f']})<br />
//为三个不同的p元素单击事件分别设定不同的处理<br />
jQuery中几个自定义的事件：<br />
（1）hover(fn1,fn2)：一个模仿悬停事件（鼠标移动到一个对象上面及移出这个对象）的方法。当鼠标移动到一个匹配的元素上面时，会触发指定的第一个函数。当鼠标移出这个元素时，会触发指定的第二个函数。<br />
//当鼠标放在表格的某行上时将class置为over，离开时置为out。<br />
$(“tr”).hover(function(){<br />
$(this).addClass(“over”);<br />
},<br />
       function(){<br />
       $(this).addClass(“out”);<br />
});<br />
（2）ready(fn):当DOM载入就绪可以查询及操纵时绑定一个要执行的函数。<br />
$(document).ready(function(){alert(“Load Success”)})<br />
//页面加载完毕提示“Load Success”,相当于onload事件。与$(fn)等价<br />
（3）toggle(evenFn,oddFn): 每次点击时切换要调用的函数。如果点击了一个匹配的元素，则触发指定的第一个函数，当再次点击同一元素时，则触发指定的第二个函数。随后的每次点击都重复对这两个函数的轮番调用。<br />
       //每次点击时轮换添加和删除名为selected的class。<br />
       $(“p”).toggle(function(){<br />
              $(this).addClass(“selected”);   <br />
       },function(){<br />
              $(this).removeClass(“selected”);<br />
       });<br />
（4）trigger(eventtype): 在每一个匹配的元素上触发某类事件。<br />
例如：<br />
       $(“p”).trigger(“click”);              //触发所有p元素的click事件<br />
（5）bind(eventtype,fn)，unbind(eventtype): 事件的绑定与反绑定<br />
从每一个匹配的元素中（添加）删除绑定的事件。<br />
例如：<br />
$(“p”).bind(“click”, function(){alert($(this).text());});       //为每个p元素添加单击事件<br />
$(“p”).unbind();       //删除所有p元素上的所有事件<br />
$(“p”).unbind(“click”)       //删除所有p元素上的单击事件</p>
<p><strong>10、几个实用特效功能</strong><br />
其中toggle()和slidetoggle()方法提供了状态切换功能。<br />
如toggle()方法包括了hide()和show()方法。<br />
slideToggle()方法包括了slideDown()和slideUp方法。</p>
<p><strong>11、几个有用的jQuery方法</strong><br />
$.browser.浏览器类型：检测浏览器类型。有效参数：safari, opera, msie, mozilla。如检测是否ie：$.browser.isie，是ie浏览器则返回true。<br />
$.each(obj, fn)：通用的迭代函数。可用于近似地迭代对象和数组（代替循环）。<br />
如<br />
$.each( [0,1,2], function(i, n){ alert( “Item #” + i + “: ” + n ); });<br />
等价于：<br />
var tempArr=[0,1,2];<br />
for(var i=0;i&lt;tempArr.length;i++){<br />
       alert(“Item #”+i+”: “+tempArr);<br />
}<br />
也可以处理json数据，如<br />
$.each( { name: “John”, lang: “JS” }, function(i, n){ alert( “Name: ” + i + “, Value: ” + n ); });<br />
结果为：<br />
Name:name, Value:John<br />
Name:lang, Value:JS<br />
$.extend(target,prop1,propN)：用一个或多个其他对象来扩展一个对象，返回这个被扩展的对象。这是jquery实现的继承方式。<br />
如：<br />
$.extend(settings, options);      <br />
//合并settings和options，并将合并结果返回settings中，相当于options继承setting并将继承结果保存在setting中。<br />
var settings = $.extend({}, defaults, options);<br />
//合并defaults和options，并将合并结果返回到setting中而不覆盖default内容。<br />
可以有多个参数（合并多项并返回）<br />
$.map(array, fn)：数组映射。把一个数组中的项目(处理转换后)保存到到另一个新数组中，并返回生成的新数组。<br />
如：<br />
var tempArr=$.map( [0,1,2], function(i){ return i + 4; });<br />
tempArr内容为：[4,5,6]<br />
var tempArr=$.map( [0,1,2], function(i){ return i &gt; 0 ? i + 1 : null; });<br />
tempArr内容为：[2,3]<br />
$.merge(arr1,arr2):合并两个数组并删除其中重复的项目。<br />
如：$.merge( [0,1,2], [2,3,4] )       //返回[0,1,2,3,4]<br />
$.trim(str)：删除字符串两端的空白字符。<br />
如：$.trim(“  hello, how are you?   “);        //返回”hello,how are you? ”</p>
<p><strong>12、解决自定义方法或其他类库与jQuery的冲突</strong><br />
很多时候我们自己定义了$(id)方法来获取一个元素，或者其他的一些js类库如prototype也都定义了$方法，如果同时把这些内容放在一起就会引起变量方法定义冲突，Jquery对此专门提供了方法用于解决此问题。<br />
使用jquery中的jQuery.noConflict();方法即可把变量$的控制权让渡给第一个实现它的那个库或之前自定义的$方法。之后应用 Jquery的时候只要将所有的$换成jQuery即可，如原来引用对象方法$(“#msg”)改为jQuery(“#msg”)。<br />
如：<br />
jQuery.noConflict();<br />
// 开始使用jQuery<br />
jQuery(“div   p”).hide();<br />
// 使用其他库的 $()<br />
$(“content”).style.display = &#8216;none&#8217;;</p>
<h2  class="related_post_title">您可能感兴趣的文章</h2><ul class="related_post"><li><a href="http://www.52shidai.com/javascript/jquery/926.html" title="jQ.Mobi—针对移动设备优化的jQuery">jQ.Mobi—针对移动设备优化的jQuery</a></li><li><a href="http://www.52shidai.com/web-front/809.html" title="Flickr 的开发者的 Web 应用优化技巧">Flickr 的开发者的 Web 应用优化技巧</a></li><li><a href="http://www.52shidai.com/javascript/jquery/748.html" title="jQuery-bind不能处理绑定hover事件">jQuery-bind不能处理绑定hover事件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/738.html" title="9个实用jQuery日历插件">9个实用jQuery日历插件</a></li><li><a href="http://www.52shidai.com/javascript/jquery/732.html" title="jQuery 操作css 设置样式">jQuery 操作css 设置样式</a></li><li><a href="http://www.52shidai.com/seo/707.html" title="百度知道100%成功留外链实战技巧">百度知道100%成功留外链实战技巧</a></li><li><a href="http://www.52shidai.com/javascript/jquery/705.html" title="JQUERY操作XML实例教程">JQUERY操作XML实例教程</a></li><li><a href="http://www.52shidai.com/javascript/jquery/621.html" title="不要滥用jQuery的$(this)">不要滥用jQuery的$(this)</a></li><li><a href="http://www.52shidai.com/javascript/jquery/619.html" title="编写高性能的jQuery代码">编写高性能的jQuery代码</a></li><li><a href="http://www.52shidai.com/seo/589.html" title="如何增加你的网站外链">如何增加你的网站外链</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.52shidai.com/javascript/jquery/455.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

