그누보드 [G5] scroll 상단으로 / 가운데로 / 하단으로 이동하기
페이지 정보
첨부파일
-
top_btn2.zip (1.4K)
59회 다운로드 | DATE : 2018-07-20 20:47:05
본문
그누보드 sir 사이트의 우측 하단의 top / center / bottom 버튼 사용하기
1. 첨부 이미지를 그누보드 / img 폴더에 업로드
2. theme / basic / tail.php 내용에서
<button type="button" id="top_btn"><i class="fa fa-arrow-up" aria-hidden="true"></i><span class="sound_only">상단으로</span></button>
<script>
$(function() {
$("#top_btn").on("click", function() {
$("html, body").animate({scrollTop:0}, '500');
return false;
});
});
</script>
를 아래의 것으로 변경
<!--script src="//code.jquery.com/jquery-1.12.4.min.js"></script-->
<style>
/*top_btn2*/
#top_btn2{position:fixed;bottom:170px;left:0px;width:100%;_position:absolute;z-index:999; font-size:20px;}
#top_btn2 .top_btn_wp{width:1050px;margin:0 auto;position:relative}
#top_btn2 .top_btn_wp a{position:absolute;display:inline-block}
#top_btn2 .top_btn_wp a.scroll-top{width:16px;height:18px;top:0;right:-70px;background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -12px 0 no-repeat;text-indent:-9999px}
#top_btn2 .top_btn_wp a.scroll-top:hover{background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -12px -27px no-repeat}
#top_btn2 .top_btn_wp a.scroll-bottom {width:16px;height:18px;top:44px;right:-70px;background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -30px -27px no-repeat;text-indent:-9999px}
#top_btn2 .top_btn_wp a.scroll-bottom:hover {background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -30px 0 no-repeat}
#top_btn2 .top_btn_wp a.scroll-center {width:8px;height:8px;top:27px;right:-66px;background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') no-repeat;text-indent:-9999px}
#top_btn2 .top_btn_wp a.scroll-center:hover {background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') 0 -27px no-repeat}
</style>
<div id="top_btn2">
<div class="top_btn_wp">
<a href="#" title="상단으로" class="scroll-top">상단으로</a>
<a href="#" title="가운데로" class="scroll-center">가운데로</a>
<a href="#" title="하단으로" class="scroll-bottom">하단으로</a>
</div>
</div>
<script>
$(function() {
$("#top_btn2 .scroll-top").on("click", function(e) {
e.preventDefault();
$("html, body").animate({scrollTop:0}, '500');
return false;
});
$("#top_btn2 .scroll-center").on("click", function(e) {
e.preventDefault();
var middle_pos = $("body").offset().top - ( $(window).height() - $("body").outerHeight(true) ) / 2;
$("html, body").animate({scrollTop:middle_pos}, '500');
return false;
});
$("#top_btn2 .scroll-bottom").on("click", function(e) {
e.preventDefault();
var scrollBottom = $("html,body").scrollTop + $("html,body").height();
$("html, body").animate({scrollTop:$(document).height()}, '500');
return false;
});
});
</script>
1. 첨부 이미지를 그누보드 / img 폴더에 업로드
2. theme / basic / tail.php 내용에서
<button type="button" id="top_btn"><i class="fa fa-arrow-up" aria-hidden="true"></i><span class="sound_only">상단으로</span></button>
<script>
$(function() {
$("#top_btn").on("click", function() {
$("html, body").animate({scrollTop:0}, '500');
return false;
});
});
</script>
를 아래의 것으로 변경
<!--script src="//code.jquery.com/jquery-1.12.4.min.js"></script-->
<style>
/*top_btn2*/
#top_btn2{position:fixed;bottom:170px;left:0px;width:100%;_position:absolute;z-index:999; font-size:20px;}
#top_btn2 .top_btn_wp{width:1050px;margin:0 auto;position:relative}
#top_btn2 .top_btn_wp a{position:absolute;display:inline-block}
#top_btn2 .top_btn_wp a.scroll-top{width:16px;height:18px;top:0;right:-70px;background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -12px 0 no-repeat;text-indent:-9999px}
#top_btn2 .top_btn_wp a.scroll-top:hover{background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -12px -27px no-repeat}
#top_btn2 .top_btn_wp a.scroll-bottom {width:16px;height:18px;top:44px;right:-70px;background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -30px -27px no-repeat;text-indent:-9999px}
#top_btn2 .top_btn_wp a.scroll-bottom:hover {background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') -30px 0 no-repeat}
#top_btn2 .top_btn_wp a.scroll-center {width:8px;height:8px;top:27px;right:-66px;background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') no-repeat;text-indent:-9999px}
#top_btn2 .top_btn_wp a.scroll-center:hover {background:url('<?php echo G5_IMG_URL; ?>/top_btn2.png') 0 -27px no-repeat}
</style>
<div id="top_btn2">
<div class="top_btn_wp">
<a href="#" title="상단으로" class="scroll-top">상단으로</a>
<a href="#" title="가운데로" class="scroll-center">가운데로</a>
<a href="#" title="하단으로" class="scroll-bottom">하단으로</a>
</div>
</div>
<script>
$(function() {
$("#top_btn2 .scroll-top").on("click", function(e) {
e.preventDefault();
$("html, body").animate({scrollTop:0}, '500');
return false;
});
$("#top_btn2 .scroll-center").on("click", function(e) {
e.preventDefault();
var middle_pos = $("body").offset().top - ( $(window).height() - $("body").outerHeight(true) ) / 2;
$("html, body").animate({scrollTop:middle_pos}, '500');
return false;
});
$("#top_btn2 .scroll-bottom").on("click", function(e) {
e.preventDefault();
var scrollBottom = $("html,body").scrollTop + $("html,body").height();
$("html, body").animate({scrollTop:$(document).height()}, '500');
return false;
});
});
</script>
댓글목록
등록된 댓글이 없습니다.