WordPress 实现点击标题时显示加载提示“正在加载中…”
|第一步:加载jquery.min.js
外部调用:
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js"></script>
内链格式:
<script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery-1.2.3.min.js" ></script>
访问外链地址:http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js 下载该js文件,并上传到主题文件下面的js文件夹中!
第二步
把下面这段代码加到当前使用主题的header.php中
加在 </head>标签之前:
<script type="text/javascript"> $(document).ready(function() { $('h2 a').click(function(){ myloadoriginal = this.text; $(this).text('请稍等,正在努力加载中...'); var myload = this; setTimeout(function() { $(myload).text(myloadoriginal); }, 2000); }); }); </script>
上面"h2 a"如果改成"a",可以实现全部连接都显示这一效果。后面的2000是这一特效显示的时间,单位是毫秒,可根据自己网页加载速度进行修改。
【上一篇】插件名称备忘(前台不展示)
超精简Xp系统分享,老旧电脑专用!【下一篇】
0 Comments.