1、網頁設計中怎樣設置超鏈接到頁頂
<html>
<head></head>
<body id="top">
<p id="back-to-top"><a href="#top"><span></span>返回頂部</a></p>
</body>
</html>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js">
<script type="text/javascript">
$(document).ready(function(){
//首先將#back-to-top隱藏
$("#back-to-top").hide();
//當滾動條的位置處於距頂部100像素以下時,跳轉鏈接出現,否則消失
$(function () {
$(window).scroll(function(){
if ($(window).scrollTop()>100){
$("#back-to-top").fadeIn(1500);
}
else
{
$("#back-to-top").fadeOut(1500);
}
});
//當點擊跳轉鏈接後,回到頁面頂部位置
$("#back-to-top").click(function(){
$('body,html').animate({scrollTop:0},1000);
return false;
});
});
});
</script>
2、網頁製作中返回頂層代碼
在你的網頁頂部添加一個
錨記:<a
name="top"
id=「top」></a>
然後在你網站下面的:<a
href="#top">返回頂部</a>
ok了!
3、網頁設計中返回頂部怎麼設置
用到的是錨鏈接技術,你搜索下什麼是錨鏈接就知道了。
4、html css JS 怎麼設計點擊回頂部效果?
js代碼:
function pageScroll()html代碼:
<a onclick="pageScroll()" class="return-top"></a>5、給網頁加一個返回頂部的按鈕
<div id="goTopBtn" title="Top" style="bottom: 130px;">
</div>
<script type="text/javascript">6、製作網頁如何做出「返回頂部」圖標並固定在頁面右下的位置?
<!DOCTYPE HTML>
<html>
<head>
<meta charset=UTF-8>
<title>SCROLL</title>
<style type="text/css">
</style>
<script type="text/javascript">
var goToWhere = function (where)
{
var me = this;
clearInterval (me.interval);
me.site = [];
var dom = !/.*chrome.*/i.test (navigator.userAgent) ? document.documentElement : document.body;
var height = !!where ? dom.scrollHeight : 0;
me.interval = setInterval (function ()
{
var speed = (height - dom.scrollTop) / 16;
if (speed == me.site[0])
{
clearInterval (me.interval);
return null;
}
dom.scrollTop += speed;
me.site.unshift (speed);
}, 16);
};
</script>
</head>
<body>
<div style="height: 1000px; text-align: center; font-size: 200px; font-weight: bold;">5</div>
<div style="height: 1000px; text-align: center; font-size: 200px; font-weight: bold;">4</div>
<div style="height: 1000px; text-align: center; font-size: 200px; font-weight: bold;">3</div>
<div style="height: 1000px; text-align: center; font-size: 200px; font-weight: bold;">2</div>
<div style="height: 1000px; text-align: center; font-size: 200px; font-weight: bold;">1</div>
<div style="height: 1000px; text-align: center; font-size: 200px; font-weight: bold;">0</div>
<div id="back-up" onclick="goToWhere(0)"
style="border: 1px solid red; height: 100px; width: 15px; position: fixed; cursor: pointer; right: 10px; bottom: 150px;">返回頂部</div>
<div id="back-up" onclick="goToWhere(1)"
style="border: 1px solid red; height: 100px; width: 15px; position: fixed; cursor: pointer; right: 10px; bottom: 30px;">返回底部</div>
</body>
</html>
7、製作網站回頂層怎麼設計?
用javascript,返回頂部就是offsetTop=0