<?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>jquery相关文章列表 | 皇家元林</title>
	<atom:link href="https://hjyl.org/tags/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>https://hjyl.org</link>
	<description>刘元林的个人博客</description>
	<lastBuildDate>Tue, 29 Mar 2011 06:08:02 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://img.hjyl.org/uploads/2019/10/cropped-about-me-32x32.png</url>
	<title>jquery相关文章列表 | 皇家元林</title>
	<link>https://hjyl.org</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>jQuery为每张图片链接自动加上class属性</title>
		<link>https://hjyl.org/jquery-add-class-pic/</link>
					<comments>https://hjyl.org/jquery-add-class-pic/#comments</comments>
		
		<dc:creator><![CDATA[皇家元林]]></dc:creator>
		<pubDate>Tue, 29 Mar 2011 06:08:02 +0000</pubDate>
				<category><![CDATA[元林手札]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[图片]]></category>
		<category><![CDATA[属性]]></category>
		<category><![CDATA[自动]]></category>
		<category><![CDATA[链接]]></category>
		<guid isPermaLink="false">http://hjyl.org/?p=1504</guid>

					<description><![CDATA[jQuery为每张图片链接自动加上class属性]]></description>
										<content:encoded><![CDATA[<p>先上码：</p>
<pre lang="language" line="1">
/* 用 jQuery 为每张图片链接自动加上 class="thickbox" */
$('#content p a').each(function(){ //根据主题内容区的 id 设置选择器
var a_href = $(this).attr('href').toLowerCase();
var file_type = a_href.substring(a_href.lastIndexOf('.'));
if (file_type == '.jpg' || file_type == '.png' || file_type == '.gif'){$(this).addClass('thickbox')};
});
</pre>
<p>这个再配合lightbox之类的图片展示代码用起来不错。<br />
此代码发现于ZWW-http://zww.me/archives/25196</p>
<p>还有一个<br />
[warning]<code>$('.entry a:has(img)').addClass("thickbox");</code>[/warning]</p>
<div id="content-copyright"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;font-size: 13px;">版权声明: </span><span style="font-size: 13px;">本文采用 <a href="https://hjyl.org/go/aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzMuMC8=" rel="nofollow" target="_blank">BY-NC-SA</a> 协议进行授权，如无注明均为原创，转载请注明转自 <a href="https://hjyl.org">皇家元林</a><br>本文链接: <a rel="bookmark" title="jQuery为每张图片链接自动加上class属性" href="https://hjyl.org/jquery-add-class-pic/">jQuery为每张图片链接自动加上class属性</a></span></div>]]></content:encoded>
					
					<wfw:commentRss>https://hjyl.org/jquery-add-class-pic/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>用jQuery给WP加上lightbox特效</title>
		<link>https://hjyl.org/jquery-wp-lightbox/</link>
					<comments>https://hjyl.org/jquery-wp-lightbox/#comments</comments>
		
		<dc:creator><![CDATA[皇家元林]]></dc:creator>
		<pubDate>Sat, 26 Mar 2011 05:34:34 +0000</pubDate>
				<category><![CDATA[元林手札]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[lightbox]]></category>
		<category><![CDATA[wp]]></category>
		<category><![CDATA[特效]]></category>
		<guid isPermaLink="false">http://hjyl.org/?p=1486</guid>

					<description><![CDATA[用jQuery给WP加上lightbox特效]]></description>
										<content:encoded><![CDATA[<p>我找了很多关于wp图片特效的插件，WP FancyZoom、Lightbox 2等等，我的老板还是不满意，他需要那种跟QQ空间里的差不多，点开图片，放大，然后还可以上一个下一个图片预览的效果。折腾了这么久，我才发现在wp世界里，这个效果叫Lightbox特效。于是我就Google之。</p>
<p>在一<a href="https://hjyl.org/go/aHR0cDovL2xlYW5kcm92aWVpcmEuY29tL3Byb2plY3RzL2pxdWVyeS9saWdodGJveC8=" rel="nofollow" target="_blank">外国网站</a>发现用jQuery给网站加这个特效，我突然有了想法，把他用在wp里也不错的。具体操作如下：<br />
1、下载素材，<a href="http://hjyl.org/lightbox">点这里</a>。<br />
2、把里面的<strong>CSS文件夹、js文件夹和images文件夹</strong>上传到你的主题目录。<br />
3、修改jquery.lightbox-0.5.js文件，在30行的位置，或者搜索“imageLoading:”后面有几个图片的路径，将其改成绝对路径，此图片也是第2步里images文件里面的。因为这个相对路径很容易出现无法显示图片的错误。比如images/lightbox-ico-loading.gif修改成http://hjyl.org/wp-content/themes/yleave/images/lightbox-ico-loading.gif。<br />
4、在head标签里加上这句：</p>
<pre lang="language" line="1">
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.lightbox-0.5.js"></script>
</pre>
<p>如果你的主题有jQuery库，第一句就可以删掉。<br />
接着下面加上：</p>
<pre lang="language" line="1">
<script type="text/javascript">
$(function() {
	$('a').lightBox(); //给所有的链接加上lightbox特效
          //或者......
	$('.wp-caption a').lightBox(); //给wp-caption标签加上lightbox特效
          //或者......
	$('.gallery a').lightBox(); //给gallery标签加上lightbox特效
});
</script>
</pre>
<p>这个根据需要选择。<br />
5、忘了重要的一步，加上CSS样式，在style.css文件里加上这句即可：</p>
<pre lang="language" line="1">@import "css/jquery.lightbox-0.5.css";</pre>
<blockquote><p>2011年3月28日，即今天，我杯具地发现一款<a href="https://hjyl.org/go/aHR0cDovL3dvcmRwcmVzcy5vcmcvZXh0ZW5kL3BsdWdpbnMvc2xpbWJveC8=" rel="nofollow" target="_blank">Slimbox插件</a>，跟这效果一样，JS体积小到只有几KB，可惜没有自适应窗口大小功能！</p></blockquote>
<div id="content-copyright"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;font-size: 13px;">版权声明: </span><span style="font-size: 13px;">本文采用 <a href="https://hjyl.org/go/aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzMuMC8=" rel="nofollow" target="_blank">BY-NC-SA</a> 协议进行授权，如无注明均为原创，转载请注明转自 <a href="https://hjyl.org">皇家元林</a><br>本文链接: <a rel="bookmark" title="用jQuery给WP加上lightbox特效" href="https://hjyl.org/jquery-wp-lightbox/">用jQuery给WP加上lightbox特效</a></span></div>]]></content:encoded>
					
					<wfw:commentRss>https://hjyl.org/jquery-wp-lightbox/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>给朕的博客图片增加点效果</title>
		<link>https://hjyl.org/make-picture-better-effect/</link>
					<comments>https://hjyl.org/make-picture-better-effect/#comments</comments>
		
		<dc:creator><![CDATA[皇家元林]]></dc:creator>
		<pubDate>Thu, 08 Apr 2010 01:14:24 +0000</pubDate>
				<category><![CDATA[元林手札]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[图片]]></category>
		<guid isPermaLink="false">http://www.7lau.com/?p=884</guid>

					<description><![CDATA[利用jquery实现WordPress图片显隐特效]]></description>
										<content:encoded><![CDATA[<p>今天朕到处逛了一下，想给朕博客的图片添加一些效果，朕博客的图片都是外链flickr的，这点是为了防止搬家麻烦。看到一款插件叫<a href="https://hjyl.org/go/aHR0cDovL2Rvd25sb2Fkcy53b3JkcHJlc3Mub3JnL3BsdWdpbi9vdmVybGF5NHdwLnppcA==" rel="nofollow" target="_blank">Overlay4WP</a>，听说可以给图片一点效果，但是朕安装之后没一点反应，不知道怎么回事，难道需要上传到自己的空间才可以？<br />
然后就没管了。突然看到一篇文章<a href="https://hjyl.org/go/aHR0cDovL3d3dy53b3B1cy5vcmcvd29yZHByZXNzLWRlZXBpbi9kaXktdGhlbWVzLzIwNTMuaHRtbA==" rel="nofollow" target="_blank">《利用jquery实现图片显隐特效》</a>，是那只知更鸟写的，操作很简单，效果还不错。下面做个记号：<br />
演示：见本博客(把鼠标放在图片上试试)<br />
操作：1、首先需要在header.php中加载jquery，可以使用外链也可以内链。<br />
外链可以利用google为我们提供的JS库，据说可以提高js加载速度，格式如下：</p>
<pre lang="LANGUAGE" line="1"><script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js"></script></pre>
<p>内链格式为：</p>
<pre lang="LANGUAGE" line="1"><script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.min.js" ></script></pre>
<p>然后再在header.php中添加：</p>
<pre lang="LANGUAGE" line="1"><script type="text/javascript">
$(function () {
$('img').hover(
function() {$(this).fadeTo("fast", 0.5);},
function() {$(this).fadeTo("fast", 1);
});
});
</script></pre>
<p>OK，你刷新下你的博客看看效果把。<br />
还有一种是鼠标悬停到图片上时，图片变得清晰。就是把后面的代码换成下面的即可：</p>
<pre lang="LANGUAGE" line="1">
    <script type="text/javascript">
    $(function() {
    $('img').animate({"opacity": .5 });

    $('img').hover(function() {
    $(this).stop().animate({ "opacity": 1 });
    }, function() {
    $(this).stop().animate({ "opacity": .5 });
    });
    });
    </script>
</pre>
<p>采用哪种图片显隐特效就看你喜好了，这一特效支持所有浏览器。</p>
<div id="content-copyright"><span style="font-weight:bold;text-shadow:0 1px 0 #ddd;font-size: 13px;">版权声明: </span><span style="font-size: 13px;">本文采用 <a href="https://hjyl.org/go/aHR0cHM6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL2J5LW5jLXNhLzMuMC8=" rel="nofollow" target="_blank">BY-NC-SA</a> 协议进行授权，如无注明均为原创，转载请注明转自 <a href="https://hjyl.org">皇家元林</a><br>本文链接: <a rel="bookmark" title="给朕的博客图片增加点效果" href="https://hjyl.org/make-picture-better-effect/">给朕的博客图片增加点效果</a></span></div>]]></content:encoded>
					
					<wfw:commentRss>https://hjyl.org/make-picture-better-effect/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
