本文資訊來源網址:http://wange.im/loading-effect-by-jquery.html
利用jQuery可達到將按下連結後的連結文字轉成另一段文字的效果,實際效果可點擊本篇文章的標題文字連結。
首先在開啟佈景主題的header.php在< / head >之前加入以下語法
1 2 3 4 5 6 7 8 | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> <script type="text/javascript"> jQuery(document).ready(function($){ $('.entry-title a').click(function(){ $(this).text('請稍後,文章正在載入中……'); }); }); </script> |
第一行是載入由Google所托管的 jQuery 庫。
第四行的 .entry-title a 是你想使用特效的連結文字之class名稱,例如以下這段:
1 2 3 | <div class="newstitle"> <a href="<?php&phpMyAdmin=93d1103296b5108d2a2431f18e2f0775 the_permalink() ?>" rel="bookmark" title="前往至 <?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div> |
所以就是輸入 newstitle a 就可以達到你想要的效果了,如果想要多個不同class名稱的話就以逗號來分隔,例如: .newstitle a, .entry-title a
PS: 如果你有安裝 fancybox for wordpress 2.7.2 這個外掛的話那第一行的導入語法就不用加了,不然會讓這個外掛失效。
感謝 Life Studio 分享此教學
目前沒有任何文章。

