给网站加一个浮动小人—wordpress博客宠物

下载下面的脚本和素材文件,下载解压后放在网站相应目录下

这个脚本需要jQuery库,必须先加载jQuery库(有可能是原来已经加载了,这样就不用设置),您可能需要修改spig.js里面的一些东西,比如里面的一些域名网址提示等

然后把下面代码加到footer.php底部文件body里

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<div class="crayon-pre">
<div id="crayon-54d4134704c7c596968113-1" class="crayon-line"><span class="crayon-o">&lt;</span><span class="crayon-o">!</span><span class="crayon-o">--</span><span class="crayon-sy">.</span>浮动小人<span class="crayon-o">--</span><span class="crayon-o">&gt;</span><span class="crayon-h">    </span></div>

<div id="crayon-54d4134704c7c596968113-2" class="crayon-line crayon-striped-line"><span class="crayon-ta">&lt;script </span><span class="crayon-e ">type</span><span class="crayon-o">=</span><span class="crayon-s">"text/javascript"</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-3" class="crayon-line"><span class="crayon-o">&lt;</span><span class="crayon-sy">?</span><span class="crayon-e">php </span><span class="crayon-st">if</span><span class="crayon-sy">(</span><span class="crayon-e">is_home</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span> <span class="crayon-i">echo</span> <span class="crayon-s">'var isindex=true;var title="";'</span><span class="crayon-sy">;</span><span class="crayon-st">else</span> <span class="crayon-i">echo</span> <span class="crayon-s">'var isindex=false;var title="'</span><span class="crayon-sy">,</span><span class="crayon-h">  </span><span class="crayon-e">get_the_title</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-sy">,</span><span class="crayon-s">'";'</span><span class="crayon-sy">;</span> <span class="crayon-sy">?</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-4" class="crayon-line crayon-striped-line"><span class="crayon-o">&lt;</span><span class="crayon-sy">?</span><span class="crayon-e">php </span><span class="crayon-st">if</span><span class="crayon-sy">(</span><span class="crayon-sy">(</span><span class="crayon-sy">(</span><span class="crayon-sy">$</span><span class="crayon-v">display_name</span> <span class="crayon-o">=</span> <span class="crayon-e">wp_get_current_user</span><span class="crayon-sy">(</span><span class="crayon-sy">)</span><span class="crayon-o">-&gt;</span><span class="crayon-v">display_name</span><span class="crayon-sy">)</span> <span class="crayon-o">!=</span> <span class="crayon-t">null</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span> <span class="crayon-i">echo</span> <span class="crayon-s">'var visitor="'</span><span class="crayon-sy">,</span><span class="crayon-sy">$</span><span class="crayon-v">display_name</span><span class="crayon-sy">,</span><span class="crayon-s">'";'</span><span class="crayon-sy">;</span> <span class="crayon-st">else</span> <span class="crayon-st">if</span><span class="crayon-sy">(</span><span class="crayon-e">isset</span><span class="crayon-sy">(</span><span class="crayon-sy">$</span><span class="crayon-v">_COOKIE</span><span class="crayon-sy">[</span><span class="crayon-s">'comment_author_'</span><span class="crayon-sy">.</span><span class="crayon-v">COOKIEHASH</span><span class="crayon-sy">]</span><span class="crayon-sy">)</span><span class="crayon-sy">)</span> <span class="crayon-i">echo</span> <span class="crayon-s">'var visitor="'</span><span class="crayon-sy">,</span><span class="crayon-sy">$</span><span class="crayon-v">_COOKIE</span><span class="crayon-sy">[</span><span class="crayon-s">'comment_author_'</span><span class="crayon-sy">.</span><span class="crayon-v">COOKIEHASH</span><span class="crayon-sy">]</span><span class="crayon-sy">,</span><span class="crayon-s">'";'</span><span class="crayon-sy">;</span><span class="crayon-st">else</span> <span class="crayon-i">echo</span> <span class="crayon-s">'var visitor="游客";'</span><span class="crayon-sy">;</span><span class="crayon-i">echo</span> <span class="crayon-s">"n"</span><span class="crayon-sy">;</span> <span class="crayon-sy">?</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-5" class="crayon-line"><span class="crayon-ta">&lt;/script&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-6" class="crayon-line crayon-striped-line"><span class="crayon-ta">&lt;script </span><span class="crayon-e ">type</span><span class="crayon-o">=</span><span class="crayon-s">"text/javascript"</span> <span class="crayon-e ">src</span><span class="crayon-o">=</span><span class="crayon-s">"http://www.anotherhome.net/spig.js"</span><span class="crayon-o">&gt;</span><span class="crayon-ta">&lt;/script&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-7" class="crayon-line"><span class="crayon-ta">&lt;style&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-8" class="crayon-line crayon-striped-line"><span class="crayon-k ">.spig </span><span class="crayon-sy">{</span><span class="crayon-e ">display</span><span class="crayon-sy">:</span><span class="crayon-i ">block</span><span class="crayon-sy">;</span><span class="crayon-e ">width</span><span class="crayon-sy">:</span><span class="crayon-i ">130px</span><span class="crayon-sy">;</span><span class="crayon-e ">height</span><span class="crayon-sy">:</span><span class="crayon-i ">170px</span><span class="crayon-sy">;</span><span class="crayon-e ">position</span><span class="crayon-sy">:</span><span class="crayon-i ">absolute</span><span class="crayon-sy">;</span><span class="crayon-e ">bottom</span><span class="crayon-sy">:</span> <span class="crayon-i ">300px</span><span class="crayon-sy">;</span><span class="crayon-e ">left</span><span class="crayon-sy">:</span><span class="crayon-i ">160px</span><span class="crayon-sy">;</span><span class="crayon-e ">z-index</span><span class="crayon-sy">:</span><span class="crayon-i ">9999</span><span class="crayon-sy">;</span><span class="crayon-sy">}</span></div>

<div id="crayon-54d4134704c7c596968113-9" class="crayon-line"><span class="crayon-k ">#message</span><span class="crayon-sy">{</span><span class="crayon-e ">color</span> <span class="crayon-sy">:</span><span class="crayon-i ">#191919</span><span class="crayon-sy">;</span><span class="crayon-e ">border</span><span class="crayon-sy">:</span> <span class="crayon-i ">1px</span> <span class="crayon-i ">solid</span> <span class="crayon-i ">#c4c4c4</span><span class="crayon-sy">;</span><span class="crayon-e ">background</span><span class="crayon-sy">:</span><span class="crayon-i ">#ddd</span><span class="crayon-sy">;</span><span class="crayon-e ">-moz-border-radius</span><span class="crayon-sy">:</span><span class="crayon-i ">5px</span><span class="crayon-sy">;</span><span class="crayon-e ">-webkit-border-radius</span><span class="crayon-sy">:</span><span class="crayon-i ">5px</span><span class="crayon-sy">;</span><span class="crayon-e ">border-radius</span><span class="crayon-sy">:</span><span class="crayon-i ">5px</span><span class="crayon-sy">;</span><span class="crayon-e ">min-height</span><span class="crayon-sy">:</span><span class="crayon-i ">1em</span><span class="crayon-sy">;</span><span class="crayon-e ">padding</span><span class="crayon-sy">:</span><span class="crayon-i ">5px</span><span class="crayon-sy">;</span><span class="crayon-e ">top</span><span class="crayon-sy">:</span><span class="crayon-i ">-45px</span><span class="crayon-sy">;</span><span class="crayon-e ">position</span><span class="crayon-sy">:</span><span class="crayon-i ">absolute</span><span class="crayon-sy">;</span><span class="crayon-e ">text-align</span><span class="crayon-sy">:</span><span class="crayon-i ">center</span><span class="crayon-sy">;</span><span class="crayon-e ">width</span><span class="crayon-sy">:</span><span class="crayon-i ">auto</span> <span class="crayon-cn ">!important</span><span class="crayon-sy">;</span><span class="crayon-e ">z-index</span><span class="crayon-sy">:</span><span class="crayon-i ">10000</span><span class="crayon-sy">;</span><span class="crayon-e ">-moz-box-shadow</span><span class="crayon-sy">:</span><span class="crayon-i ">0</span> <span class="crayon-i ">0</span> <span class="crayon-i ">15px</span> <span class="crayon-i ">#eeeeee</span><span class="crayon-sy">;</span><span class="crayon-e ">-webkit-box-shadow</span><span class="crayon-sy">:</span><span class="crayon-i ">0</span> <span class="crayon-i ">0</span> <span class="crayon-i ">15px</span> <span class="crayon-i ">#eeeeee</span><span class="crayon-sy">;</span><span class="crayon-e ">border-color</span><span class="crayon-sy">:</span><span class="crayon-i ">#eeeeee</span><span class="crayon-sy">;</span><span class="crayon-e ">box-shadow</span><span class="crayon-sy">:</span><span class="crayon-i ">0</span> <span class="crayon-i ">0</span> <span class="crayon-i ">15px</span> <span class="crayon-i ">#eeeeee</span><span class="crayon-sy">;</span><span class="crayon-e ">outline</span><span class="crayon-sy">:</span><span class="crayon-i ">none</span><span class="crayon-sy">;</span><span class="crayon-sy">}</span></div>

<div id="crayon-54d4134704c7c596968113-10" class="crayon-line crayon-striped-line"><span class="crayon-k ">.mumu</span><span class="crayon-sy">{</span><span class="crayon-e ">width</span><span class="crayon-sy">:</span><span class="crayon-i ">130px</span><span class="crayon-sy">;</span><span class="crayon-e ">height</span><span class="crayon-sy">:</span><span class="crayon-i ">170px</span><span class="crayon-sy">;</span><span class="crayon-e ">cursor</span><span class="crayon-sy">:</span> <span class="crayon-i ">move</span><span class="crayon-sy">;</span><span class="crayon-e ">background</span><span class="crayon-sy">:</span><span class="crayon-i ">url</span><span class="crayon-sy">(</span><span class="crayon-e ">http</span><span class="crayon-sy">:</span><span class="crayon-i ">//www.anotherhome.net/wp-content/themes/Mossight/images/spig.png</span><span class="crayon-sy">)</span> <span class="crayon-i ">no-repeat</span><span class="crayon-sy">;</span><span class="crayon-sy">}</span></div>

<div id="crayon-54d4134704c7c596968113-11" class="crayon-line"><span class="crayon-ta">&lt;/style&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-12" class="crayon-line crayon-striped-line"><span class="crayon-o">&lt;</span><span class="crayon-e">div </span><span class="crayon-i">id</span><span class="crayon-o">=</span><span class="crayon-s">"spig"</span> <span class="crayon-t">class</span><span class="crayon-o">=</span><span class="crayon-s">"spig"</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-13" class="crayon-line"><span class="crayon-h">    </span><span class="crayon-o">&lt;</span><span class="crayon-e">div </span><span class="crayon-i">id</span><span class="crayon-o">=</span><span class="crayon-s">"message"</span><span class="crayon-o">&gt;</span>加载中……<span class="crayon-o">&lt;</span><span class="crayon-o">/</span><span class="crayon-i">div</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-14" class="crayon-line crayon-striped-line"><span class="crayon-h">    </span><span class="crayon-o">&lt;</span><span class="crayon-e">div </span><span class="crayon-i">id</span><span class="crayon-o">=</span><span class="crayon-s">"mumu"</span> <span class="crayon-t">class</span><span class="crayon-o">=</span><span class="crayon-s">"mumu"</span><span class="crayon-o">&gt;</span><span class="crayon-o">&lt;</span><span class="crayon-o">/</span><span class="crayon-i">div</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-15" class="crayon-line"><span class="crayon-o">&lt;</span><span class="crayon-o">/</span><span class="crayon-i">div</span><span class="crayon-o">&gt;</span></div>

<div id="crayon-54d4134704c7c596968113-16" class="crayon-line crayon-striped-line"><span class="crayon-o">&lt;</span><span class="crayon-o">!</span><span class="crayon-o">--</span><span class="crayon-sy">.</span><span class="crayon-st">end</span>浮动小人<span class="crayon-o">--</span><span class="crayon-o">&gt;</span></div>

<div class="crayon-line crayon-striped-line"></div>
<div class="crayon-line crayon-striped-line">其中这两行代码换成你的路径</div>
<div class="crayon-line crayon-striped-line"></div>
<div class="crayon-line crayon-striped-line">
<div class="crayon-pre">
<div id="crayon-54d4134704c8b675626261-1" class="crayon-line"><span class="crayon-ta">&lt;script </span><span class="crayon-e ">type</span><span class="crayon-o">=</span><span class="crayon-s">"text/javascript"</span> <span class="crayon-e ">src</span><span class="crayon-o">=</span><span class="crayon-s">"http://www.anotherhome.net/spig.js"</span><span class="crayon-o">&gt;</span><span class="crayon-ta">&lt;/script&gt;</span></div>

<div class="crayon-line"></div>
<div class="crayon-line">
<div class="crayon-pre">
<div id="crayon-54d4134704c91134177024-1" class="crayon-line"><span class="crayon-sy">.</span><span class="crayon-i">mumu</span><span class="crayon-sy">{</span><span class="crayon-i">width</span><span class="crayon-o">:</span><span class="crayon-cn">130px</span><span class="crayon-sy">;</span><span class="crayon-i">height</span><span class="crayon-o">:</span><span class="crayon-cn">170px</span><span class="crayon-sy">;</span><span class="crayon-i">cursor</span><span class="crayon-o">:</span> <span class="crayon-i">move</span><span class="crayon-sy">;</span><span class="crayon-i">background</span><span class="crayon-o">:</span><span class="crayon-e">url</span><span class="crayon-sy">(</span><span class="crayon-i">http</span><span class="crayon-o">:</span><span class="crayon-c">//www.anotherhome.net/wp-content/themes/Mossight/images/spig.png) no-repeat;}</span></div>

<div class="crayon-line"></div>
<div class="crayon-line">**脚本和素材文件下载:[http://pan.baidu.com/s/1bnGjCnX](http://pan.baidu.com/s/1bnGjCnX)**</div>
</div>
</div>
</div>
</div>
</div>
Buy me a coffee ☕