欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

WordPress

當前位置:主頁 > CMS教程 > WordPress >

WordPress增加返回頂部效果的方法

來源:本站原創(chuàng)|時間:2020-01-11|欄目:WordPress|點擊: 次

本文實例講述了WordPress增加返回頂部效果的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

返回頂部效果不是WordPress自帶的功能,這是一款js或jquery的效果,這里就來給大家介紹在WordPress中增加反回頂部效果的方法.

第一步:在下面主題文件footer.php底下加上這段代碼:

復制代碼
代碼如下:
<script src="top.js" type="text/javascript" charset="utf-8"></script >
<div id="scroll"><a href="javascript:void(0)" onclick="goto_top()" title="返回頂部">TOP</a></div>

top.js代碼如下:

復制代碼
代碼如下:
//<![CDATA[
var goto_top_type = -1;
var goto_top_itv = 0;
function goto_top_timer()
{
var y = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;
var moveby = 15;
y -= Math.ceil(y * moveby / 100);
if (y < 0) {
y = 0;
}
if (goto_top_type == 1) {
document.documentElement.scrollTop = y;
}
else {
document.body.scrollTop = y;
}
if (y == 0) {
clearInterval(goto_top_itv);
goto_top_itv = 0;
}
}
function goto_top()
{
if (goto_top_itv == 0) {
if (document.documentElement && document.documentElement.scrollTop) {
goto_top_type = 1;
}
else if (document.body && document.body.scrollTop) {
goto_top_type = 2;
}
else {
goto_top_type = 0;
}
if (goto_top_type > 0) {
goto_top_itv = setInterval('goto_top_timer()', 50);
}
}
}
//]]>

第二步:在主題文件style.css文件中加入以下樣式:

復制代碼
代碼如下:
/*返回頂部*/
#scroll {display:block; width:30px; margin-right:-380px;
position:fixed;
right:50%;
top:90%;
_margin-right:-507px;
_position:absolute;
_margin-top:30px;
_top:expression(eval(document.documentElement.scrollTop));
}
#scroll a {
display:block;
float:right;
padding:9px 5px;
cursor: pointer;
background-color:#444;
color:#fff;
border-radius:5px;
text-decoration: none;
font-weight:bold;
}
#scroll a:hover {
background-color:#333;
color:#669900;
text-decoration: none;
font-weight:bold;
}

這樣我們再清除緩存是不是就可以看到有個返回頂部的效果按鈕了,這樣你的WordPress博客中的所有頁面都會有返回頂部效果了.

希望本文所述對大家的WordPress建站有所幫助。

上一篇:WordPress獲取指定分類文章數(shù)量的方法

欄    目:WordPress

下一篇:WordPress實現(xiàn)彩色標簽云的方法

本文標題:WordPress增加返回頂部效果的方法

本文地址:http://mengdiqiu.com.cn/a1/WordPress/12720.html

網(wǎng)頁制作CMS教程網(wǎng)絡編程軟件編程腳本語言數(shù)據(jù)庫服務器

如果侵犯了您的權利,請與我們聯(lián)系,我們將在24小時內(nèi)進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權所有