都會提供回到最上層的按鈕供使用者快速捲到最上層。
想要快速整合嗎?
可以參考這篇文章
http://www.allbloggertricks.com/2013/04/scroll-to-top-jquery-button-for-blogger.html (這網站超多blogger的技巧可以參考!!)
這個網誌提供的方法就是寫一個go to top的jQuery外掛,這樣你也不用引入外部的javascript檔,可以無痛設定。
修改細節請參考這篇說明: [Blogger HACK] 套用Bootstrap的選單導航列
程式碼:
<style type="text/css">
#abt-Top {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
width: 100px;
background-color: #EEEEEE;
background-color: rgba(238, 238, 238, 0.6);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='
#99EEEEEE',EndColorStr='#99EEEEEE');text-align: center;
padding: 5px;
position: fixed;
bottom: 100px;
right: 100px;
cursor: pointer;
color: #444;
text-decoration: none;
border: 1px solid #C9C9C9;
}
</style>
Step2: 加入jQuery、外掛程式碼、按鈕的HTML
程式碼:
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js' type='text/javascript'/>
<script src='//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js' type='text/javascript'/>
<script type='text/javascript'>
$(function(){
$.fn.scrollToTop = function() {
$(this).hide().removeAttr("href");
if ($(window).scrollTop() != "0") {
$(this).fadeIn("slow")
}
var scrollDiv = $(this);
$(window).scroll(function() {
if ($(window).scrollTop() == "0") {
$(scrollDiv).fadeOut("slow")
} else {
$(scrollDiv).fadeIn("slow")
}
});
$(this).click(function() {
$("html, body").animate({
scrollTop: 0
}, "slow")
})
}
});
$(function(){
$("#abt-Top").scrollToTop();
});
</script>
<!-- Scroll to Top Plugin for Blogger by www.allbloggertricks.com-->
<a href="#" id="abt-Top" style="display: none;">回到最上層 :D </a>
沒有留言:
張貼留言
留個話吧:)