有童鞋在問(wèn)我如何在wordpress頁(yè)面中添加到達(dá)底部、返回頂部、留言懸浮按鈕,大多數(shù)主題都包含了它,但是還是有個(gè)別主題沒(méi)有這個(gè),所以,在這里主要是向新手們以及主題中沒(méi)有這個(gè)的童鞋如何添加它!雖然網(wǎng)上已經(jīng)有很多類似代碼,但是對(duì)于菜鳥們來(lái)說(shuō)還是很有必要說(shuō)明一下!高手請(qǐng)繞道!
我這里提供的代碼,純html+css,杜絕js!
而我,將實(shí)現(xiàn)的效果如下:
廢話咱就不多說(shuō)了,直接開(kāi)始!
1、下載按鈕所需的圖片!我已經(jīng)提供了下載地址在文章下方!
2、在 wordpress主題的style.css中增加如下css代碼!直接添加到底部即可!個(gè)別主題改變顏色或者樣式后主樣式文件沒(méi)有在style.css中,大家需要去甄別!
01.go{width:47px;height:106px;background-02 03color:#CCC;posion:fixed;_position:absolute;_top:expression(eval04 05(document.documentElement.scrollTop+document.documentElement.clientHeight-06 07this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||200)-(parseInt08 09(this.currentStyle.marginBottom,10)||0)));right:12px;bottom:25%;border-radius:5px;box-10 11shadow:0 0 2px #6E6E6E}12.go a{background:url(images/a.png) no-repeat;display:block;text-13 14indent:999em;width:37px;margin:5px;border:0;overflow:hidden;float:left}15.go .top{background-position:0 -33px;height:22px}16.go .feedback{background-position:0 -54px;height:32px}17.go .bottom{background-position:0 -88px;height:22px}18.go .top:hover{background-position:-38px -33px}19.go .feedback:hover{background-position:-38px -54px}20.go .bottom:hover{background-position:-38px -88px}
3、在頁(yè)面底部,通常是footer.php中加入如下代碼:
1<a name="gobottom"> </a>2<div class="go">3 <a title="返回頂部" class="top" href="#gotop"></a>4 <a title="歡迎留言" class="feedback" href="http://www.luoxiao123.cn/liu-yan-ban"5 6target="_blank"></a>7 <a title="返回底部" class="bottom" href="#gobottom"></a>8</div>
4、也是最后一步,在頁(yè)面頂部,通常是wordpress主題文件header.php中增加如下代碼:
1<a name="gotop"> </a>
到了這一步,就算是大功告成了!
未經(jīng)允許不得轉(zhuǎn)載:445IT之家 » wordpress添加到達(dá)底部、返回頂部、留言懸浮按鈕