<?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>邪罗刹的菠萝阁 &#187; jquery</title>
	<atom:link href="http://www.rainmoe.com/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rainmoe.com</link>
	<description>One code, one world ...</description>
	<lastBuildDate>Thu, 29 Dec 2011 14:04:21 +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>如何使用jQuery载入Gravatar的头像</title>
		<link>http://www.rainmoe.com/2010/09/02/gravatar-jquery-load-method/</link>
		<comments>http://www.rainmoe.com/2010/09/02/gravatar-jquery-load-method/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 21:27:25 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[作品 [Work]]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=2019</guid>
		<description><![CDATA[> 此文送给强力的 Zww 童鞋，祝愿他变得更加强力哈，^O^。主要是如何用 jQuery 载入 Gravatar 头像。

> 不过因为突然发现 JavaScript 木有自带 md5 函数，所以不得不载入某牛人的第三方代码库来搞定它。



<span class="readmore"><a href="http://www.rainmoe.com/2010/09/02/gravatar-jquery-load-method/" title="如何使用jQuery载入Gravatar的头像">阅读全文——共1036字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 此文送给强力的 <a target='_blank' rel='nofollow' href='http://zww.me/'>Zww</a> 童鞋，祝愿他变得更加强力哈，^O^。主要是如何用 jQuery 载入 Gravatar 头像。<br />
> 不过因为突然发现 JavaScript 木有自带 md5 函数，所以不得不载入某牛人的第三方代码库来搞定它。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/2010/09/Cap0001049.png' /></p>
<p><span id="more-2019"></span><strong>一. 演示地址：</strong></p>
<p>> o(*￣▽￣*)ゞ 强力滴传送门 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/jquery_001/'>http://www.evlos.org/apps/demo/jquery_001</a></p>
<p><strong>二. 代码解释：</strong></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
jQuery(document).ready(function($){
	$('#box .submit').click(function(){
		$('#box .ava').html('&lt;img src=&quot;http://gravatar.com/avatar/'+hex_md5($('#box .mail').attr('value'))+'?s=180&amp;r=G&quot; /&gt;');
	}); //hex_md5函数可以把mail地址转换为md5形态
//s=180 (s参数表示头像的尺寸，单位是像素)
//r=G (r参数表示头像的显示等级，G表示通用等级)
//d=Xxx (d参数为默认头像地址，可以舍弃)
});
</pre>
<p><strong>三. 源代码下载：</strong></p>
<p>> Md5.js - <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=md5.js&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=md5.js&#038;can=2&#038;q=</a><br />
> Jquery-1.4.2.min.js - <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=jquery-1.4.2.min.js&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=jquery-1.4.2.min.js</a></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
	&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
	&lt;title&gt;Ajax Gravatar Demo V1&lt;/title&gt;
	&lt;style type=&quot;text/css&quot;&gt;
		#box {
			margin:30px;
		}
		#box .submit {
			color: #aaa;
		}
		#box .submit:hover {
			color:blue;
			cursor:pointer;
		}
	&lt;/style&gt;
	&lt;!-- 注意$的兼容性，如果发生冲突，请自行改成jQuery --&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.4.2.min.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;md5.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		jQuery(document).ready(function($){
			$('#box .submit').click(function(){
				$('#box .ava').html('&lt;img src=&quot;http://gravatar.com/avatar/'+hex_md5($('#box .mail').attr('value'))+'?s=180&amp;r=G&quot; /&gt;');
			});
		});
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id=&quot;box&quot;&gt;
		&lt;p&gt;&lt;input class=&quot;mail&quot; value=&quot;4tyle8@gmail.com&quot; /&gt; || &lt;span class=&quot;submit&quot;&gt;点击这里获取头像&lt;/span&gt;（可自行用blur() 方法或其他方法替换）&lt;/p&gt;
		&lt;p&gt;头像：&lt;/p&gt;
		&lt;p class=&quot;ava&quot;&gt;&lt;/p&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>四. 随记：</strong></p>
<p>> 已经顺利到荷兰鸟，前几天小邪一直在弄新房子，还有身份证和银行卡地址也要变更，花了好多时间。<br />
> 然后到学校处理完事物。今天终于回来鸟，装死期结束，正常的代码人生开始继续咯。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/09/02/gravatar-jquery-load-method/feed/</wfw:commentRss>
		<slash:comments>128</slash:comments>
		</item>
		<item>
		<title>jQuery多项投票演示与局部刷新预习</title>
		<link>http://www.rainmoe.com/2010/07/26/jquery-more-votes/</link>
		<comments>http://www.rainmoe.com/2010/07/26/jquery-more-votes/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 22:01:40 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[vote]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1975</guid>
		<description><![CDATA[> 请注意_(￣0￣)_喔，这个程序只为演示 AJAX，并非正式程序，所以木有做任何严格的重复投票防护。

> 此文主要介绍如何实现多项投票的方法，以及灰常简单的 jQuery 局部刷新的应用方法，o( ∩ω∩ )m。



<span class="readmore"><a href="http://www.rainmoe.com/2010/07/26/jquery-more-votes/" title="jQuery多项投票演示与局部刷新预习">阅读全文——共757字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 请注意_(￣0￣)_喔，这个程序只为演示 AJAX，并非正式程序，所以木有做任何严格的重复投票防护。<br />
> 此文主要介绍如何实现多项投票的方法，以及灰常简单的 jQuery 局部刷新的应用方法，o( ∩ω∩ )m。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000574.png' /></p>
<p><span id="more-1975"></span><strong>一. jQuery多项投票演示：</strong></p>
<p>> 这次小邪木有做什么防护，只要刷新页面就可以再次投票，因为此程序的目的只是演示 jQuery 效果。<br />
> 所以，嘎嘎嘎，如果你想要抒发自己强烈的思想感情，然后情不自禁地刷新页面鸟，就随便投票吧。</p>
<p>> 强力的纯洁的无知的传送门 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/ajax_005/'>http://www.evlos.org/apps/demo/ajax_005</a></p>
<p><strong>二. jQuery多项投票重点代码注释：</strong></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
//这里小邪只是把和原先那次有明显区别，并且作用较大的代码贴出来作一些说明
//如果有更多疑问，请查看原先的文章，如果还觉得迷糊，请留言询问即可 O(∩_∩)O

function getdata() {
	global $dbfile;
	$data = file_get_contents($dbfile);
	$array = explode('|',$data); //把数据以 | 为分隔，分割到数组
	return $array;
}
//在 index.php 使用这个函数的来只是读取投票数据 ”0|0|0|0|0|0|0|0|0“

function showlist() {
	global $votenum,$votes;
	$data = getdata();
	function is_odd($num){ //判断偶数的较另类的方法
		return (is_numeric($num)&amp;($num&amp;1));
	}
	//额，实际上后来小邪并木有使用判断结果，因为觉得没必要以颜色分行
	for ($i=0;$i&lt;$votenum;$i++) {
		if (is_odd($i)) { $trclass = 'odd'; } else { $trclass = 'even'; }
		echo '&lt;tr id=&quot;vote_'.($i+1).'&quot; class=&quot;'.$trclass.'&quot;&gt;&lt;td class=&quot;gray&quot;&gt;#'.($i+1).'&lt;/td&gt;&lt;td&gt;'.$votes[$i].'&lt;/td&gt;&lt;td class=&quot;gray&quot;&gt;已有 &lt;span class=&quot;count vote_'.($i+1).'&quot;&gt;'.$data[$i].'&lt;/span&gt; 票&lt;/td&gt;&lt;td class=&quot;gray warn&quot;&gt;已投票&lt;/td&gt;&lt;td class=&quot;gray button&quot;&gt;[投票]&lt;/td&gt;&lt;/tr&gt;'.&quot;\n&quot;;
		//这里给每一行的数据附一个 id，内容为 ”vote_投票编号“
		//我们靠 class=&quot;count&quot; 来找到投票数，靠 warn 和 button 来变换投票前后显示文字
	}
}
//在 index.php 使用这个函数来输出投票列表

$votenum = count($votes);
//在 config.php 里面的这个语句用来统计数组包含的数量

$ivote = $_POST['ivote'];
for ($i=1;$i&lt;=$votenum;$i++) {
	if ($ivote=='vote_'.$i) {
		$res = $i;
	}
}
//在 vote.php 使用这个循环来判断用户所投的票，Post来的数据为 vote_1 vote_2 等
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(document).ready(function(){
	$(&quot;#vote .button&quot;).click( //先找到按键元素，即 ”投票“ 文字处
		function() {
			var votesorder = $(this).parent().attr(&quot;id&quot;); //取父元素的 id 来判断当前所投何票
			var count=eval($(&quot;#vote .&quot;+votesorder).text())+1; //然后对其票数加一
			$(&quot;#vote .&quot;+votesorder).css(&quot;color&quot;,&quot;green&quot;).text(count); //显示加一后的票数并变色
			$(&quot;#vote .button&quot;).css(&quot;display&quot;,&quot;none&quot;); //隐藏 ”投票&quot;
			$(&quot;#vote .warn&quot;).css(&quot;display&quot;,&quot;inline&quot;); //显示 “已投票”
			$.ajax({
				type:'POST',
				dataType:'text',
				url:'vote.php',
				data:'ivote='+votesorder
			});
			//Post发送数据，类型 text，送给 vote.php，内容为父元素的 id
			/* $.cookie('vote_s81jaj881jja', 'yes', { expires: 3 }); */
			//不打算做 cookie 防护了
		}
	);
});
</pre>
<p><strong>三. 局部刷新预习：</strong></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(document).ready(function(){
	$(&quot;#box .button&quot;).click(
		function() {
			data=$.ajax({url:&quot;time.php&quot;,async:false});
			/* async表示禁止异步请求，因为我们接下来就要使用返回的数据 */
			$(&quot;#box .target&quot;).html(data.responseText);
		}
	);
});
</pre>
<p>> 简单的当前秒数局部刷新演示地址 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/ajax_006/'>http://www.evlos.org/apps/demo/ajax_006</a></p>
<p><strong>四. 演示程序下载：</strong></p>
<p>> 首先是前面的 jQuery 多项投票演示程序的下载地址，后面则是 jQuery 预习演示程序的下载地址，哈。</p>
<p>> <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=jquery-more-votes-example-v1.zip&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=jquery-more-votes-example-v1.zip</a><br />
> <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=jq-areafresh-easy-v1.zip&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=jq-areafresh-easy-v1.zip</a></p>
<p><strong>五. 附言：</strong></p>
<p>> 虽然小邪已经在代码中注释说这个程序木有做严格防护，但是仍然很感谢报告 BUG 的盆友，嘿嘿 ;D。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000579.png' /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/07/26/jquery-more-votes/feed/</wfw:commentRss>
		<slash:comments>72</slash:comments>
		</item>
		<item>
		<title>jQuery制作AJAX的POST方式支持按键</title>
		<link>http://www.rainmoe.com/2010/07/25/up-button-for-jquery/</link>
		<comments>http://www.rainmoe.com/2010/07/25/up-button-for-jquery/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 01:21:17 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[vote]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1974</guid>
		<description><![CDATA[> 嘿嘿，这篇文章是 jQuery AJAX 的提高教程之简单部分，小邪制作了一个 “支持一下” 的按键作为演示。

> 因为是简单的演示，所以只是 POST 了数据，并木有获取任何返回数据，变动部分只是 jQuery 效果。



<span class="readmore"><a href="http://www.rainmoe.com/2010/07/25/up-button-for-jquery/" title="jQuery制作AJAX的POST方式支持按键">阅读全文——共2128字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 嘿嘿，这篇文章是 jQuery AJAX 的提高教程之简单部分，小邪制作了一个 “支持一下” 的按键作为演示。<br />
> 因为是简单的演示，所以只是 POST 了数据，并木有获取任何返回数据，变动部分只是 jQuery 效果。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000571.png' /></p>
<p><span id="more-1974"></span><strong>一. 演示地址：</strong></p>
<p>> 如上图所示，当你点击 “我也支持！” 文字之后，就会使用 POST 方式发送数据给 vote.php 文件来处理。<br />
> 之后，票数也会自动加一，不过这不是返回数据，只是显示效果上面做了些小动作，因为要求较简单。</p>
<p>> Ajax 支持按键演示的强力的宇宙最放荡的传送门 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/ajax_003'>http://www.evlos.org/apps/demo/ajax_003</a></p>
<p>> 当然咯，o(*≧▽≦)ツ 你如果觉得小邪特别坏的话，就去这里狂点吧，嘎嘎，这里木有做重复投票限制喔。<br />
> 特纯洁无知的传送门 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/ajax_004'>http://www.evlos.org/apps/demo/ajax_004</a></p>
<p><strong>二. 程序代码及注释：</strong></p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;?php
//此文件是 index.php
include 'config.php'; //包含 config.php 文件，提供 $dbfile 储存文本数据库文件名
$count = file_get_contents($dbfile); //读取文本数据库
if ($_COOKIE['vote_s81jaj881jja']=='yes') { $upclass = '&lt;span class=&quot;hid&quot;&gt;[您已经投过票了！]&lt;span&gt;'; }
else { $upclass = '&lt;span class=&quot;button&quot;&gt;[我也支持！]&lt;span&gt;'; }
//仅仅根据 cookie 来防止重复投票，因为根据 ip 以及 Email 之类的资料来防护的方法较为复杂
?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;Ajax 支持按键演示&lt;/title&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; /&gt;
&lt;script language=&quot;javascript&quot; src=&quot;jq.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot; src=&quot;cookie.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot; src=&quot;main.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;box&quot;&gt;
	&lt;p class=&quot;title&quot;&gt;投票测试：&lt;/p&gt;
	&lt;ul&gt;
		&lt;li&gt;小邪是坏淫 &lt;span class=&quot;hid&quot;&gt;[有 &lt;span class=&quot;num&quot;&gt;&lt;?php echo $count; ?&gt;&lt;/span&gt; 票表示支持]&lt;/span&gt; &lt;?php echo $upclass; ?&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;?php
//此文件是 config.php
$dbfile = 't81oa.txt';
//Setting 文本数据库文件名
if (!file_exists($dbfile)) {
	$handle = fopen($dbfile,'w+');
	fwrite($handle,'0');
	fclose($handle);
}
//Check database 如果找不到此文件，就新建一个，写入数字0
?&gt;
</pre>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;?php
//此文件是 vote.php
include 'config.php';
if (isset($_POST['ivote'])) { //如果有 POST 发送来变量 ivote
	$ivote = $_POST['ivote'];
	if ($ivote == 'yes') { //并且 ivote 的值为 yes
		$count = file_get_contents($dbfile); //就读取文本数据库里面的投票数
		$count++; //投票数加一
		$handle = fopen($dbfile,'w+');
		fwrite($handle,$count);
		fclose($handle);
		//然后写入新的投票数
	}
}
?&gt;
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
/* 此文件是 main.js */
$(document).ready(function(){
	$(&quot;#box .button&quot;).click( /* 如果点击了 “我也支持！” 按键 */
		function() {
			var count=eval($(&quot;#box .num&quot;).text())+1; /* 就获取显示出来的投票数并加一 */
			$(&quot;#box .num&quot;).css(&quot;color&quot;,&quot;green&quot;).text(count); /* 显示新的投票数 */
			$(this).css(&quot;display&quot;,&quot;none&quot;); /* 隐藏 “我也支持！” 按键 */
			$.ajax({
				type:'POST',
				dataType:'text',
				url:'vote.php',
				data:'ivote=yes'
			}); /* AJAX 方式发送数据 */
			$.cookie('vote_s81jaj881jja', 'yes', { expires: 3 }); /* 新建cookie表示已投票 */
		}
	);
	/* For stupid IE */
	$(&quot;.button&quot;).hover( /* 鼠标悬停在 “我也支持！” 按键上面就变色 */
		function() {
			$(this).css(&quot;color&quot;,&quot;blue&quot;);
		},
		function() {
			$(this).css(&quot;color&quot;,&quot;#ccc&quot;);
		}
	);
});
</pre>
<pre class="brush: css; auto-links: false; html-script: false; title: ; notranslate">
/* 此文件是 style.css */
#box .title { color:red; }
#box .hid { color:#ccc; }
#box .button { color:#ccc; cursor:pointer; }
</pre>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
13 //此文件是 t81oa.txt，即数据库文件，存储投票数
</pre>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
//文件名是 cookie.js，这是一个 jQuery 插件，程序代码较长就不贴出来了，下面是使用方法介绍
$.cookie('the_cookie'); //读取Cookie值
$.cookie('the_cookie', 'the_value'); //设置cookie的值
$.cookie('the_cookie', 'the_value', {expires: 7, path: '/', domain: 'jquery.com', secure: true});//新建一个cookie 包括有效期 路径 域名等
$.cookie('the_cookie', 'the_value'); //新建cookie
$.cookie('the_cookie', null); //删除一个cookie
</pre>
<p><strong>三. 演示程序下载：</strong></p>
<p>> <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=ajax-simple-vote-v1.zip&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=ajax-simple-vote-v1.zip&#038;can=2&#038;q=</a></p>
<p><strong>四. 附言：</strong></p>
<p>> 小邪在上面贴出来的程序代码中已经做了相当详细的注释，所以也就不另外做特别的讲解鸟 ╮(╯▽╰)╭。<br />
> 有问题请在留言中提问，下次的提高教程会提供灰常劲爆的演示程序，挺不住鸟，睡觉去 (～﹃～)。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/07/25/up-button-for-jquery/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
		<item>
		<title>如何用强大的jQuery来进行Ajax操作</title>
		<link>http://www.rainmoe.com/2010/07/23/ajax-and-jquery/</link>
		<comments>http://www.rainmoe.com/2010/07/23/ajax-and-jquery/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 23:56:07 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1973</guid>
		<description><![CDATA[> 此文为以后的 AJAX 文章作为铺垫，并不深入。举例介绍 Load 函数与页面载入完成后执行的方法。

> 然后提供了最新的 jQuery 库在各个 CDN 的托管地址，最后是 Low-Level-Ajax 方法的简单介绍。



<span class="readmore"><a href="http://www.rainmoe.com/2010/07/23/ajax-and-jquery/" title="如何用强大的jQuery来进行Ajax操作">阅读全文——共2022字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 此文为以后的 AJAX 文章作为铺垫，并不深入。举例介绍 Load 函数与页面载入完成后执行的方法。<br />
> 然后提供了最新的 jQuery 库在各个 CDN 的托管地址，最后是 Low-Level-Ajax 方法的简单介绍。</p>
<p><img src='http://www.rainmoe.com/wp-content/uploads/old/Cap0000552.png' /></p>
<p><span id="more-1973"></span><strong>一. jQuery 的准备工作：</strong></p>
<p>> 首选的当然是谷歌的CDN，谷歌服务器的强大是毫无疑问的，嘿嘿，而且速度也不差，毕竟是CDN呢。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p>> 当然啰，如果碰巧有微软控，那就加上这个吧 ╮(╯▽╰)╭。同时表示，童鞋，你木有的救了，信春哥吧。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p>> 官网代码库，也有不少人载入呢，好像某次把官网服务器拖垮过，不过后来他们换了更强的服务器。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.4.2.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>二. 页面载入完成才执行：</strong></p>
<p>> jQuery 代码一般都写在这里面，这里面的代码是在页面载入完整之后才运行的，这样才正常嘛。<br />
> 不然如果载入木有完成就要操作元素，那你叫 jquery 到哪里去找 ╮(╯▽╰)╭，估计它会疯掉，嘎嘎。</p>
<p>> 不过一定要注意自己的页面是否能够在用户能够容忍的时间内载入，否则你碰到的杯具就大了 (╯o╰)。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(document).ready(function(){
//代码，这里需要强大的代码，哇卡卡卡卡卡
});
</pre>
<p><strong>三. Ajax - jQuery 的 Load 函数：</strong></p>
<p>> jQuery 的 load 函数是一种简单的但是灰常强大的 AJAX 函数。它的语法如下 -</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(selector).load(url,data,callback);
</pre>
<p>> 下面是一个例子，首先是事件触发，触发的条件则是点击 ID 为 loadstart 的元素，这里是个按键。<br />
> 然后将 ID 为 cont 的元素其中的内容替换为 test.txt 文件里面的内容。嘿嘿，JQ 就是简单。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(document).ready(function(){
	$(&quot;#loadstart&quot;).click(function(){
		$('#cont').load('test.txt');
	});
});
</pre>
<p>> 演示传送门 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/ajax_002/'>http://www.evlos.org/apps/demo/ajax_002/</a><br />
> 当然啰，这个是 Test.txt 文件的地址 - <a target='_blank' rel='nofollow' href='http://www.evlos.org/apps/demo/ajax_002/test.txt'>http://www.evlos.org/apps/demo/ajax_002/test.txt</a></p>
<p><strong>四. Low Level Ajax 方法：</strong></p>
<p>> 嘿嘿，先简单介绍一下，文章太长不好。如果想要详细实例与解说，请听下回分解 o(*￣▽￣*)ゞ。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(selector).load(url,data,callback)	//把远程数据加载到被选的元素中
$.ajax(options)	//把远程数据加载到 XMLHttpRequest 对象中
$.get(url,data,callback,type)	//使用 HTTP GET 来加载远程数据
$.post(url,data,callback,type)	//使用 HTTP POST 来加载远程数据
$.getJSON(url,data,callback)	//使用 HTTP GET 来加载远程 JSON 数据
$.getScript(url,callback)	//加载并执行远程的 JavaScript 文件

(selector) //jQuery 元素选择器语法
(url) //被加载的数据的 URL（地址）
(data) //发送到服务器的数据的键/值对象
(callback) //当数据被加载时，所执行的函数
(type) //被返回的数据的类型 (html,xml,json,jasonp,script,text)
(options) //完整 AJAX 请求的所有键/值对选项
</pre>
<p><strong>五. 附言：</strong></p>
<p>> @lucifierya: 啧啧 围观菊花 @rericy: 于是怎样!!! @lucifierya: @rericy 你这个头像 。。。<br />
> 嘿嘿，又是推上的事儿。睡觉前看到的，话说这可怜的家伙，╮(╯▽╰)╭。头像硬是给人当成菊花了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2010/07/23/ajax-and-jquery/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>使用jQuery添加图片载入提示</title>
		<link>http://www.rainmoe.com/2009/12/27/images-loading/</link>
		<comments>http://www.rainmoe.com/2009/12/27/images-loading/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 04:18:43 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[loading]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1854</guid>
		<description><![CDATA[> 因为不可抗拒的因素，小邪昨天下午和今天上午都在离地球上最近的电脑有11公里的地方。

> 终于，在春哥的保佑之下，小邪终于在今天下午回到了我可爱的电脑面前。



<span class="readmore"><a href="http://www.rainmoe.com/2009/12/27/images-loading/" title="使用jQuery添加图片载入提示">阅读全文——共1855字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 因为不可抗拒的因素，小邪昨天下午和今天上午都在离地球上最近的电脑有11公里的地方。<br />
> 终于，在春哥的保佑之下，小邪终于在今天下午回到了我可爱的电脑面前。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture09391.jpg" /></p>
<p>> 呵呵，这篇文章讲的东西灰常简单，因为昨天没法一日一博，只好今天早晚各一篇。<br />
> 以弥补各位看官受伤的心灵，小邪可是很善良的喔 (*^__^*) ，哇卡卡卡卡 O(∩_∩)O。</p>
<p><span id="more-1854"></span><strong>1. 图片载入提示 Demo 传送门：</strong></p>
<p>> 小邪已经使用 Opera Safari Firefox Chrome IE6 测试过图片载入提示的代码了。<br />
> 现在浏览器缓存机制十分强大，所以如果想多次浏览，请使用 Ctrl+F5 无缓存刷新。<br />
> 额，这个快捷键在 FF 里是可以用的，其他浏览器小邪就不清楚咯。</p>
<p>> <a target="_blank" href="http://www.evlos.org/apps/demo/images_loading">http://www.evlos.org/apps/demo/images_loading</a></p>
<p><strong>2. 当然要先载入 jQuery 库：</strong></p>
<p>> 呵呵，这是为新来的童鞋提供的步骤，老童鞋就请直接跳过咯。<br />
> 貌似原来的 lastest.js 不见了，可能太多人载入这个文件，官方服务器挺不住。<br />
> 所以这个还是在 Google 服务器上托管的 JS 文件，请放心使用 O(∩_∩)O。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>3. 然后载入图片Loading提示的 jQuery 插件：</strong></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
(function($){
jQuery.fn.LoadImage=function(settings){
settings = jQuery.extend({ scaling : true,
width : 500,height : 500,loadpic:&quot;&quot; }, settings);
return this.each(function() {
$.fn.LoadImage.Showimg( $( this ), settings );
});};
$.fn.LoadImage.Showimg = function($this, settings){
var src=$this.attr(&quot;src&quot;);
var img=new Image();
img.src=src;
var autoScaling=function(){
if (settings.scaling) {
if (img.width &gt; 0 &amp;&amp; img.height &gt; 0) {
if (img.width / img.height &gt;= settings.width / settings.height) {
if (img.width &gt; settings.width) {
$this.width(settings.width);
$this.height((img.height * settings.width) / img.width);
}else {
$this.width(img.width);
$this.height(img.height);
}}else {
if (img.height &gt; settings.height) {
$this.height(settings.height);
$this.width((img.width * settings.height) / img.height);
}else {
$this.width(img.width);
$this.height(img.height);
}}}}}
$this.attr(&quot;src&quot;,&quot;&quot;);
var loading=$(&quot;&lt;img alt=\&quot;加载中...\&quot; title=\&quot;图片加载中...\&quot; src=\&quot;&quot;
+settings.loadpic+&quot;\&quot; /&gt;&quot;);
$this.hide();
$this.after(loading);
$(img).load(function(){
autoScaling();
loading.remove();
$this.attr(&quot;src&quot;,this.src);
$this.show();
});}})(jQuery);
&lt;/script&gt;
</pre>
<p><strong>4. 设置此 jQuery 插件的参数：</strong></p>
<p>> Loadpic 是设置提示图片的路径，宽度高度就不用管它了。<br />
> 这个宽度高度是图片最大高和图片最大宽，按比例缩放的，不过我们用不到。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
$(function(){
	$(&quot;img&quot;).LoadImage({scaling : true,
			width : 3000,
			height : 3000,
			loadpic:&quot;imgload.gif&quot;});
});
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/12/27/images-loading/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>几个比较经典的jQuery小技巧</title>
		<link>http://www.rainmoe.com/2009/12/16/some-classic-jquery-tricks/</link>
		<comments>http://www.rainmoe.com/2009/12/16/some-classic-jquery-tricks/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 08:16:30 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1671</guid>
		<description><![CDATA[> ╮(╯▽╰)╭，上一篇文章有点杯具，有点乱，小邪心情不大好，所以请大家体谅下咯。

> 现在讲一下几个比较经典，而且比较常用的 jQuery 技巧，相信你能举一反三。



<span class="readmore"><a href="http://www.rainmoe.com/2009/12/16/some-classic-jquery-tricks/" title="几个比较经典的jQuery小技巧">阅读全文——共2553字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> ╮(╯▽╰)╭，上一篇文章有点杯具，有点乱，小邪心情不大好，所以请大家体谅下咯。<br />
> 现在讲一下几个比较经典，而且比较常用的 jQuery 技巧，相信你能举一反三。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0817.jpg" /></p>
<p>> 唔，这个主题挂的时间也够长的了，也该换换了，到时候找找看有没有合胃口的主题。<br />
> 话说，最近有点偏向 PHP 去了，我发现贪多嚼不烂，所以就又回到主题咯，(*^__^*) 嘻嘻。</p>
<p><span id="more-1671"></span><strong>1. Jquery 库的调用：</strong></p>
<p>> 呵呵，相信很多童鞋早就会了，不过还是得提一下，忘记就杯具咯。<br />
> 第一个是常用的 Google 托管处的 jQuery 库地址。<br />
> 而第二个则是 jQuery 官方网站的库地址，随时获取最新版，嘿嘿。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;
type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script src=&quot;http://code.jquery.com/jquery-latest.js&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>2. Load() 函数：</strong></p>
<p>> 这个也是很不错的喔，很多地方都可以用上。<br />
> 比如想在某些图片没有载入之前加个提示之类的。<br />
> 或者对页面载入过程最后一个元素使用，则可以提供整页面的载入提示。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0819.jpg" /></p>
<p>> 下面只是一个简单的例子，选择器选择的是 Img 标签。<br />
> 然后搜索属性，只是属性类型为 Src 即图片地址，后面则是图片地址的内容。<br />
> 在图片载入完成之后则会弹出一个提示框表示图片已经载好。<br />
> <strong>注意！！</strong>请一定要填入与目标元素内填的完全相同的 Src，否则会杯具的。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script&gt;
jQuery(document).ready(function($){
    $('img').attr('src', '/global/tool/picroom/save/beauty/00001.jpg')
		.load(function() {
     alert('Image Loaded');
    });
});
&lt;/script&gt;
</pre>
<p>> 演示页面传送门：<a target="_blank" href="http://www.evlos.org/apps/demo/jquery_load">http://www.evlos.org/apps/demo/jquery_load</a></p>
<p><strong>3. 简单的垂直居中：</strong></p>
<p>> 这里使用的是 Height() 函数，选择器里的 document 表示整个页面。<br />
> 下面查找的是 Class 为 Move 的元素，It_height 定义为元素高度。<br />
> 然后将变量 Global_height 定义为整个页面的高度，即页顶至页底的距离。<br />
> 然后将此元素的至顶部的距离调整为整个页面的高度的一半即可。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0820.jpg" /></p>
<p>> 呵呵，相信有兴趣的童鞋已经可以举一反三咯。<br />
> jQuery 对 CSS 进行调整的能力是灰常强大的 O(∩_∩)O。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script&gt;
jQuery(document).ready(function($){
	var global_height = $(document).height();
	var it_height = $('.move').height();
	$('.move').css({'position' : 'absolute' , 'top' :
		global_height/2 - it_height/2});
});
</pre>
<p></script></p>
<p>> 演示页面传送门：<a target="_blank" href="http://www.evlos.org/apps/demo/jquery_height">http://www.evlos.org/apps/demo/jquery_height</a></p>
<p><strong>4. jQuery 与 Onclick 事件结合：</strong></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;div onclick=&quot;var global_height = $(document).height();
	var it_height = $('.move').height();
	$('.move').css({'position' : 'absolute' , 'top' :
	global_height/2 - it_height/2});&quot;&gt;Move It !&lt;/div&gt;
</pre>
<p>> 把上面的代码放到这里来，则鼠标点击此 DIV 之后执行代码。</p>
<p><strong>5. ReplaceWith 函数：</strong></p>
<p>> 下面的代码是寻找 Class 为 Demo 的元素，然后将其整个替换掉。<br />
> 整个的意思，是包含了前后的标签的，所以替换函数内别忘记写标签喔。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0821.jpg" /></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script&gt;
jQuery(document).ready(function($){
	$('.demo').replaceWith('&lt;div style=&quot;padding-top:30px&quot;&gt;Replaced !&lt;/div&gt;');
});
&lt;/script&gt;
</pre>
<p>> 演示页面传送门：<a target="_blank" href="http://www.evlos.org/apps/demo/jquery_replace">http://www.evlos.org/apps/demo/jquery_replace</a></p>
<p><strong>6. Load() 函数的运用（页面载入提示）：</strong></p>
<p>> 首先写好 CSS，绝对定位到页面右上角。</p>
<pre class="brush: css; auto-links: false; html-script: false; title: ; notranslate">
#loading {
	position:absolute;	z-index:900;text-align:center;
	background-color:#eef2fa;border:1px solid #d8e3e8;
	color:#000;font-size:12px;padding:3px;width:80px;
	right:0;top:0;
}
</pre>
<p>> 然后用 jQuery 然后在所有图片载入完成之后，隐藏 Loading DIV。<br />
> 别忘记载入 jQuery 库哈，刚才测试代码的时候地址写错了，差点疯掉。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script&gt;
jQuery(document).ready(function($){
    $('img').load(function(){
		$('#loading').css(&quot;display&quot;,&quot;none&quot;);
    });
});
&lt;/script&gt;
</pre>
<p>> 随便某处插入一个 DIV 即可，O(∩_∩)O 哈哈。</p>
<pre class="brush: php; auto-links: false; html-script: false; title: ; notranslate">
&lt;div id=&quot;loading&quot;&gt;Loading ...&lt;/div&gt;
</pre>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0822.jpg" /></p>
<p>> 演示页面传送门：<a target="_blank" href="http://www.evlos.org/apps/demo/jquery_loading">http://www.evlos.org/apps/demo/jquery_loading</a></p>
<p>7. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/12/16/some-classic-jquery-tricks/feed/</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
		<item>
		<title>各种各样的jQueryCSS下拉菜单</title>
		<link>http://www.rainmoe.com/2009/12/12/make-a-pull-down-menu-for-child-pages-by-jquery/</link>
		<comments>http://www.rainmoe.com/2009/12/12/make-a-pull-down-menu-for-child-pages-by-jquery/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 08:10:10 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[menu]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1513</guid>
		<description><![CDATA[> 呵呵 O(∩_∩)O，小邪最近在玩鼠标事件来着，所以介绍一些不同的 CSS 和 jQuery 下拉菜单。

> 话说 jQuery 的效果真的很酷，很让人喜欢。期待 CSS 的动画模块早日被主流浏览器支持。



<span class="readmore"><a href="http://www.rainmoe.com/2009/12/12/make-a-pull-down-menu-for-child-pages-by-jquery/" title="各种各样的jQueryCSS下拉菜单">阅读全文——共2229字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 呵呵 O(∩_∩)O，小邪最近在玩鼠标事件来着，所以介绍一些不同的 CSS 和 jQuery 下拉菜单。<br />
> 话说 jQuery 的效果真的很酷，很让人喜欢。期待 CSS 的动画模块早日被主流浏览器支持。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/mmm-1.jpg" /></p>
<p>> 平滑移动是很舒服的效果，但移动需要时间，若需要频繁使用下拉菜单，也许不是最好的选择。<br />
> P.s. 最近想做的事情好多喔，想学 PHP、AJAX，还想学 jQuery。杯具的是时间不够 ╮(╯▽╰)╭。 </p>
<p><span id="more-1513"></span></p>
<p>1. <strong>CSS Visibility 属性</strong>：</p>
<p>> 这个属性在下面的普通 CSS 下拉菜单里有用到，所以先了解一下。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0747.jpg" /></p>
<p>2. <strong>普通的 CSS 下拉菜单</strong>：</p>
<p>> 一般的 CSS 下拉菜单是灰常简单的，只是用了 Hover 伪类而已。<br />
> 此伪类的作用是，当鼠标悬浮在元素上方时，向元素添加样式，移开就移除样式。<br />
> 呵呵，代码我就不贴了，需要的都在这个页面里面，查看源代码就好。<br />
> 话说，这个纯 CSS 下拉菜单就<strong>不要使用 IE6 浏览器</strong>了，不然会很杯具的。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/mmm-11.jpg" /></p>
<p>> Demo 传送门 - <a target="_blank" href="Http://tool.evlos.org/demo/css_simple_menu">Http://tool.evlos.org/demo/css_simple_menu</a></p>
<p>3. <strong>普通的 JS 下拉菜单</strong>：</p>
<p>> 呵呵，其实这里只是比上面多了下面的一行 CSS 和 JavaScript 代码。让 IE6 不那么杯具而已。</p>
<pre class="brush: css; auto-links: false; html-script: false; title: ; notranslate">
#menu li.jshover ul { left:auto; }
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=text/javascript&gt;
&lt;!--
function menuFix() {
    var sfEls = document.getElementById(&quot;menu&quot;).getElementsByTagName(&quot;li&quot;);
    for (var i=0; i&lt;sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
        this.className+=(this.className.length&gt;0? &quot; &quot;: &quot;&quot;) + &quot;jshover&quot;;
        }
        sfEls[i].onMouseDown=function() {
        this.className+=(this.className.length&gt;0? &quot; &quot;: &quot;&quot;) + &quot;jshover&quot;;
        }
        sfEls[i].onMouseUp=function() {
        this.className+=(this.className.length&gt;0? &quot; &quot;: &quot;&quot;) + &quot;jshover&quot;;
        }
        sfEls[i].onmouseout=function() {
        this.className=this.className.replace(new RegExp(&quot;( ?|^)jshover\\b&quot;),
&quot;&quot;);
        }
    }
}
window.onload=menuFix;
//--&gt;
&lt;/script&gt;
</pre>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/mmm-21.jpg" /></p>
<p>> Demo 传送门 - <a target="_blank" href="Http://tool.evlos.org/demo/js_simple_menu">Http://tool.evlos.org/demo/js_simple_menu</a></p>
<p>4. <strong>jQuery 淡入淡出下拉菜单</strong>：</p>
<p>> <strong>注意！！</strong>jQuery 的动画效果中效果名称的大小写灰常重要，错误则会导致效果无效。<br />
> <strong>注意！！</strong>如果出现非 IE8 浏览器出现不居中的位移，请加入这个属性 -Webkit-padding-start:0px。<br />
> 好吧，这次在 IE6 里面虽然没有那么杯具，但是淡入淡出效果还是蛮杯具的。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/mmm-31.jpg" /></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function() {
		$('#menu ul').addClass('children');
		var f1 = function() {
			$(this).children('ul').fadeIn();
		};
		var f2 = function() {
			$(this).children('ul').fadeOut();
		};
		$('#menu li').hover(f1, f2);
	});
&lt;/script&gt;
</pre>
<p>> Demo 传送门 - <a target="_blank" href="Http://tool.evlos.org/demo/jquery_fade_menu">Http://tool.evlos.org/demo/jquery_fade_menu</a></p>
<p>5. <strong>jQuery 无限级下拉菜单</strong>：</p>
<p>> 灰常方便的无限级下拉菜单，有淡入淡出的效果，虽然淡入淡出在 IE6 里是杯具的。<br />
> 顺便在有子菜单的父菜单右边加了一条 3px 的边表示它还有下级。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0749.jpg" /></p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function() {
		$('#menu ul').addClass('children');
		$('#menu .children').prev('a').addClass('notice');
		var f1 = function() {
			$(this).children('ul').fadeIn();
		};
		var f2 = function() {
			$(this).children('ul').fadeOut();
		};
		$('#menu li').hover(f1, f2);
	});
&lt;/script&gt;
</pre>
<p>> 不过可以去除淡入淡出，改为出现和消失，就没有问题啦 O(∩_∩)O，嘿嘿。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function() {
		$('#menu ul').addClass('children');
		$('#menu .children').prev('a').addClass('notice');
		var f1 = function() {
			$(this).children('ul').show();
		};
		var f2 = function() {
			$(this).children('ul').hide();
		};
		$('#menu li').hover(f1, f2);
	});
&lt;/script&gt;
</pre>
<p>> Demo 传送门 - <a target="_blank" href="Http://tool.evlos.org/demo/unlimited_menu">Http://tool.evlos.org/demo/unlimited_menu</a></p>
<p>6. <strong>四种下拉菜单打包下载（Update）（jQuery 库的为 Google 托管地址）</strong>：</p>
<p>> <a target="_blank" href="http://code.google.com/p/evlosbox/downloads/detail?name=menu_demo.rar&#038;can=2&#038;q=">http://code.google.com/p/evlosbox/downloads/detail?name=menu_demo.rar</a></p>
<p>7. <strong>蛋疼着给几个理论整合了一下</strong>：</p>
<p>> 传说派：哥只是个传说，表迷恋哥。<br />
> 寂寞派：哥吃的不是饭，是寂寞。<br />
> 杯具派：杯具啊！</p>
<p>> 整合版：（- _ -）哥不只是个传说，哥还是个带杯具的寂寞 ~！</p>
<p>8. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong> 。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/12/12/make-a-pull-down-menu-for-child-pages-by-jquery/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>jQuery点击链接文字后替换文字</title>
		<link>http://www.rainmoe.com/2009/12/04/click-the-link-that-use-jquery-replace-link-text-to-another/</link>
		<comments>http://www.rainmoe.com/2009/12/04/click-the-link-that-use-jquery-replace-link-text-to-another/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 05:34:11 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[replace]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1355</guid>
		<description><![CDATA[> 小邪今天把博客文章标题加上了 jQuery 点击文字替换效果，有兴趣可以返回文章列表点点看。

> 呵呵，实际上灰常简单的，就只需要一个 Click 事件，然后修改 Text 为载入中就好了。



<span class="readmore"><a href="http://www.rainmoe.com/2009/12/04/click-the-link-that-use-jquery-replace-link-text-to-another/" title="jQuery点击链接文字后替换文字">阅读全文——共1324字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 小邪今天把博客文章标题加上了 jQuery 点击文字替换效果，有兴趣可以返回文章列表点点看。<br />
> 呵呵，实际上灰常简单的，就只需要一个 Click 事件，然后修改 Text 为载入中就好了。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0598.jpg" /></p>
<p>> jQuery 查找元素的语法跟 CSS 中是一样的，比如我的文章标题就是 .post .title h2 a 。<br />
> O(∩_∩)O 然后我打算把博客上所有的链接都加上自动替换的效果，嘿嘿嘿嘿，那样子就太壮观啦。</p>
<p><span id="more-1355"></span>1. <strong>首先载入 jQuery 库（谷歌提供的托管地址）</strong>：</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js&quot;&gt;
&lt;/script&gt;
</pre>
<p>2. <strong>然后添加点击后替换文字效果的JS代码</strong>：</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(document).ready(function($){ 

$('a').click(function(){
	$(this).text('载入中 ...');
	});

});
&lt;/script&gt;
</pre>
<p>> 呵呵，相信你看出了我说话的漏洞了，我并没有说替换后还会变回来。<br />
> 所以在对带 Target="_blank" 的打开新窗口的链接使用此效果之后，新的窗口打开。<br />
> 而旧的窗口还在那里，同时里面的链接文字就一直保持在 “载入中 ...” 的字样，那样就杯具了。</p>
<p>3. <strong>进阶使用点击后替换文字效果的JS代码</strong>：</p>
<p>> 那么下面要实现的就是在 1.8 秒钟以后自动将链接文字替换回来。<br />
> 一般网页的载入时间是 1.3 秒钟，然后假设新窗口打开之后立即切换回来，就总共算 1.8 秒。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(document).ready(function($){ 

$('a').click(function(){
	myloadoriginal = this.text;
	$(this).text('载入中 ...');
	var myload = this;
	setTimeout(function() { $(myload).text(myloadoriginal); }, 1800);
});

});
&lt;/script&gt;
</pre>
<p>4. <strong>关于 jQuery 选择器的简单解说</strong>：</p>
<p>> 如果觉得麻烦直接就直接使用我的进阶方法吧，这个是对整个站点的所有链接实现的。<br />
> 然后就可以完美地实现 jQuery 人性化的加载提示功能，祝你好运 O(∩_∩)O。</p>
<p>> 其实 jQuery 的元素选择器跟 CSS 几乎一致，层层递进比较容易理解。<br />
> .post .title h2 a 是选择我的模板的文章标题，具体的请根据实际情况指定。</p>
<p>5. <strong>自行下载 jQuery 库</strong>：</p>
<p>> 传送门：<a target="_blank" rel="nofollow" href="http://code.google.com/p/jqueryjs/downloads/list">http://code.google.com/p/jqueryjs/downloads/list</a><br />
> 然后上传到自己的站点，并将以下代码上的地址修改我你站点上文件的路径。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;jQuery库的地址&quot;&gt;&lt;/script&gt;
</pre>
<p>6. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong> 。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/12/04/click-the-link-that-use-jquery-replace-link-text-to-another/feed/</wfw:commentRss>
		<slash:comments>86</slash:comments>
		</item>
		<item>
		<title>jQuery悬停元素弹动与内联元素</title>
		<link>http://www.rainmoe.com/2009/12/02/jquery-mouseover-effect-to-make-elements-moving/</link>
		<comments>http://www.rainmoe.com/2009/12/02/jquery-mouseover-effect-to-make-elements-moving/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 16:23:40 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[display]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[hover]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mouse]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1246</guid>
		<description><![CDATA[> 呵呵，这次讲一讲 jQuery 鼠标悬停时候的元素弹动效果，还有重要的内联元素概念。

> 元素弹动是指鼠标悬停某个元素，比如 DIV 上的时候，DIV 会向某个方向弹过去。



<span class="readmore"><a href="http://www.rainmoe.com/2009/12/02/jquery-mouseover-effect-to-make-elements-moving/" title="jQuery悬停元素弹动与内联元素">阅读全文——共4584字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 呵呵，这次讲一讲 jQuery 鼠标悬停时候的元素弹动效果，还有重要的内联元素概念。<br />
> 元素弹动是指鼠标悬停某个元素，比如 DIV 上的时候，DIV 会向某个方向弹过去。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/unnamed-21.jpg" /></p>
<p>> 如图分别使用了 Display:block 与使用 Display:inline 的 CSS 效果代码，左边的并不美观。<br />
> 而右边的非常在整齐，这就是神奇并且必备的 Display 参数，而 Inline 表示此元素为内联元素。</p>
<p><span id="more-1246"></span>1. <strong>关于Display的属性</strong>：</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0555.jpg" /></p>
<p>2. <strong>使用 Display:block 实现可移动效果</strong>：</p>
<p>> 好吧，实际上 Inline 和今天要说的 jQuery 的关系是反的。因为我们用了 Inline 就不能使用弹动效果了。<br />
> 内联元素就是在一行内的元素，只能放在行内；块级元素，就是一个四方块，可以放在页面上任何地方。<br />
> 因为 Inline 是内联元素，而 Block 是块级元素，所以这里只能使用 Block 来实现此效果。</p>
<p>> 至于把那些字给水平居中就使用 padding-top:0.5em; 即可，顶部填充0.5个字的长度。</p>
<p>> 下面的代码可以使 Id 为 momo 的 DIV 实现弹动效果。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
jQuery(document).ready(function($){
$(&quot;#momo&quot;).hover(function (){
	$(this).stop().animate({marginTop:&quot;15px&quot;}, 350,&quot;easeOutBounce&quot;);
	}
	,function () {
    $(this).stop().animate({marginTop:&quot;0px&quot;}, 150,&quot;easeOutBounce&quot;);
	});
});
});
</pre>
<p>> 同时需要 Jquery.easing 插件的支持，所以请将以下代码加入你的 JS文件。<br />
> 灵活使用 Jquery.easing 插件可以实现很多弹动效果，更多的请询问谷歌，谢谢 ^_^。</p>
<p>3. <strong>Jquery.easing 插件代码</strong>：</p>
<p>> 下面是灰常强大的 Jquery.easing.1.3 的全部代码，去掉了些没营养的东西：</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) &lt; 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) &lt; 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) &lt; 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) &lt; 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) &lt; 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) &lt; 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a &lt; Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a &lt; Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a &lt; Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t &lt; 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		if ((t/=d/2) &lt; 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) &lt; (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t &lt; (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t &lt; (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t &lt; d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/12/02/jquery-mouseover-effect-to-make-elements-moving/feed/</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>添加jQuery悬停效果与排除元素</title>
		<link>http://www.rainmoe.com/2009/11/25/add-jquery-mouseover-effect-and-exclude-element/</link>
		<comments>http://www.rainmoe.com/2009/11/25/add-jquery-mouseover-effect-and-exclude-element/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 15:29:58 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[代码 [Code]]]></category>
		<category><![CDATA[exclude]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mouseover]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1166</guid>
		<description><![CDATA[> 吼吼 O(∩_∩)O，向 jQuery 进军啦，那么首当其冲需要添加的是 jQuery 鼠标悬停效果。

> 其实很多地方讲到了这个效果，那么我这里的特色就是让某些地方不使用此效果。



<span class="readmore"><a href="http://www.rainmoe.com/2009/11/25/add-jquery-mouseover-effect-and-exclude-element/" title="添加jQuery悬停效果与排除元素">阅读全文——共2095字</a></span>]]></description>
			<content:encoded><![CDATA[<p>> 吼吼 O(∩_∩)O，向 jQuery 进军啦，那么首当其冲需要添加的是 jQuery 鼠标悬停效果。<br />
> 其实很多地方讲到了这个效果，那么我这里的<strong>特色</strong>就是让某些地方不使用此效果。</p>
<p><img src="http://www.rainmoe.com/wp-content/uploads/old/Capture0441.jpg" /></p>
<p>> 那么很多童鞋应该发现我的博客已经开始使用 jQuery 效果了，虽然 jQuery 1.3.2 库有50多KB。<br />
> 不过我图片都是70多KB，也不差这一点。那么接触 JavaScript 就从 jQuery 开始吧。</p>
<p><strong>P.s.</strong> 我最希望的是每个来我博客的人都能有所收获，那才是我的动力。</p>
<p><span id="more-1166"></span><strong>初步了解</strong>：<br />
> 首先是 jQuery库 是一个简洁快速灵活的JavaScript框架。<br />
> 它能让你在你的网页上简单的操作文档、处理事件、实现特效并为Web页面添加Ajax交互。</p>
<p><strong>特点</strong>：<br />
> 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本身带有的一些特效外，可以通过插件实现更多功能。</p>
<p><strong>使用方法</strong>：<br />
> 当前最流行的是从Google提供的服务中加载，地址如下。<br />
> http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js<br />
> 当然也可以从 http://jquery.com/ jQuery 的官网下载上传到自己的网站然后加载。<br />
> 在网页的 html 标签之内任何地方都可以使用以下代码进行加载。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;Js文件地址&quot;&gt;&lt;/script&gt;
</pre>
<p><strong>添加悬停效果</strong>：<br />
> 以下代码可以直接写成一个 Js文件 。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
jQuery(document).ready(function($){ 

	$(‘a’).mouseover(function(tot){
		this.myHref = this.href;
		this.myHref = (this.myHref.length &gt; 45 ?
			this.myHref.substring(0,45)+&quot; ...&quot; : this.myHref);
		var hoverbox = &quot;&lt;div id='hoverbox'&gt;&quot;+this.myHref+&quot;&lt;/div&gt;&quot;;
		$('body').append(hoverbox);
		$('#hoverbox').css({
			&quot;opacity&quot;:&quot;0.9&quot;,&quot;top&quot;:(tot.pageY+20)+&quot;px&quot;,
			&quot;left&quot;:(tot.pageX+10)+&quot;px&quot;}).show('middle');})
			.mouseout(function(){$('#hoverbox').remove();
		}).mousemove(function(e){$('#hoverbox').css({
			&quot;top&quot;:(tot.pageY+20)+&quot;px&quot;,&quot;left&quot;:(tot.pageX+10)+&quot;px&quot;
		});
	});

});
</pre>
<p><strong>解说</strong>：<br />
> mouseover 表示鼠标悬停在带有 a 标签的元素上的时候执行此函数。<br />
> this.myHref.length 表示鼠标指向的文字的链接长度，这里使用45个字符进行限制。<br />
> 大于45个英文字符的Url则截断，然后在后面加上“ ...”。<br />
> substring 方法使用 start 和 end 两者中的较小值作为子字符串的起始点，较大值则为终点。<br />
> 即从第0位开始到第45位，substring(0,45)。<br />
> 然后定义一个 hoverbox 变量。<br />
> 使用 append 插入html代码，接着指定 hoverbox 的默认CSS，opacity 是透明度。<br />
> pageY 指定相对Y轴坐标，pageX 指定X轴。mouseout 表示鼠标移走，mousemove 表示鼠标在元素上移动。<br />
> 在元素上移动的时候保持不动，移开就 remove。</p>
<p><strong>排除元素</strong>：<br />
> 下面代码之间的函数都是调用 jQuery 库的，在下面代码中插入下面的下面的代码 (^o^)。</p>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
jQuery(document).ready(function($){
});
</pre>
<pre class="brush: jscript; auto-links: false; html-script: false; title: ; notranslate">
$(&quot;#sidebar&quot;).mouseover(function(tot1){
	$('#hoverbox').remove();
});
</pre>
<p>> 我的模板的 sidebar 是一个ID 所以这里用 #sidebar 查找元素。<br />
> 这样子就不会在边栏显示了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rainmoe.com/2009/11/25/add-jquery-mouseover-effect-and-exclude-element/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached (Feed is rejected)
Page Caching using memcached
Database Caching 1/45 queries in 0.033 seconds using memcached
Object Caching 619/724 objects using memcached

Served from: www.rainmoe.com @ 2012-02-09 17:01:25 -->
