Quantcast
Channel: Have To Share » WP
Viewing all articles
Browse latest Browse all 2

WP文章标题链接添加正在加载中提示

$
0
0

点击文章标题链接会提示“正在加载中…”看上去很好玩是不是。下面就教大家把这个特效加到你的主题模板中。

首先打开你所使用主题的header.php模板文件,在</head>标签前添加:

 <script type=”text/javascript” src=”

http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js”></script>

如果你的主题已加载了JQuery,这步就免了。

再把下面这段代码同样加到</head>标签

<script type="text/javascript">
$(document).ready(function() { $('h2 a,h3 a').click(function(){ myloadoriginal = this.text; $(this).text('正在给力加载中 …'); var myload = this;
setTimeout(function() { $(myload).text(myloadoriginal); }, 2011); });}); </script>

其中”h2 a”是主题文章标题的标签选择器,可根据具体主题模板进行修改,如果改为:“a”,可实现全部链接都添加这一特效。后面的数字2011是这一特效的显示时间(毫秒),可酌情修改。


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images