之前在某些博客中看到一個打賞功能,自己也想嘗試一下。
參考:
https://github.com/greedying/tctip
第一步:進入“我的博客”->“管理”->“設置”,往下拉,找到“博客側邊欄公告”后面,申請“JS”使用。
申請成功后顯示為這樣:
第二步,插入打賞功能代碼。
greedying/tctip在TA的DEMO中已給出詳細的代碼
<!DOCTYPE html> <html> <head> <title>贊助</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!--<script type="text/javascript" src="http://static.tctip.com/tctip-1.0.2.js"></script>--> <script type="text/javascript" src="http://raw.githack.com/greedying/tctip/master/dist/tctip-1.0.3.min.js"></script> <script> new tctip({ top: '20%', button: { id: 9, type: 'zanzhu' }, list: [ { type: 'alipay', qrImg: 'https://files.cnblogs.com/files/huanghongbo/zfb_sponser.bmp' }, { type: 'wechat', qrImg: 'https://files.cnblogs.com/files/huanghongbo/wx_sponser.bmp' } ] }).init() </script> </head> <body> </body> </html>
備注:在參考文章中引用的js是比較老的版本了,最新可用版本為1.0.3。
最后,再次感謝https://github.com/greedying/tctip!!