Mar 14, 2013

Tạo nút trở lại đầu trang (có ẩn)



*Bước 1 : Đăng nhập blogger > Mẫu > Chỉnh sửa HTML


*Bước 2 : Kích chọn Mở rộng Mẫu tiện ích,ấn tổ hợp phím Ctr + F,tìm thẻ </body>

*Bước 3 : Chèn đoạn code sau trước thẻ </body>


<style type='text/css'>
#bttop{border:1px solid #4adcff;background:#24bde2;text-align:center;padding:5px;position:fixed;bottom:35px;right:10px;cursor:pointer;display:none;color:#fff;font-size:11px;font-weight:900;}
#bttop:hover{border:1px solid #ffa789;background:#ff6734;}
</style>
<div id='bttop'>BACK TO TOP</div>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>$(function(){$(window).scroll(function(){if($(this).scrollTop()!=0){$('#bttop').fadeIn();}else{$('#bttop').fadeOut();}});$('#bttop').click(function(){$('body,html').animate({scrollTop:0},800);});});</script>

Các bạn có thể sửa dòng chữ BACK TO TOP thành Lên đầu trang,Lên trên,Trở lại đầu trang...

Sau đó chọn Lưu mẫu để hoàn thành.

Bình luận

 
Lên đầu trang