Skip to content

Commit

Permalink
#375 Add a button of return to top
Browse files Browse the repository at this point in the history
  • Loading branch information
koda-masaru committed May 20, 2016
1 parent 1bf88ea commit 050f406
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<!-- /copy -->
</div>
<!-- /footer -->
<p class="pagetop" style="display: none;"><a href="#content_top">トップ</a></p>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<script type="text/javascript" src="<%= request.getContextPath() %>/bower/notify.js/notify.js"></script>
<script type="text/javascript" src="<%= request.getContextPath() %>/bower/jquery-oembed-all/jquery.oembed.js"></script>

<script type="text/javascript" src="<%= jspUtil.mustReloadFile("/js/common.js") %>"></script>


<script type="text/javascript">
var _CONTEXT = '<%= request.getContextPath() %>';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</ol>
--%>

<div class="container">
<div class="container" id="content_top">
${param.PARAM_CONTENT}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
</div>

<div class="container">
<div class="container" id="content_top">
${param.PARAM_CONTENT}
</div>

Expand Down
3 changes: 2 additions & 1 deletion src/main/webapp/WEB-INF/views/commons/layout/layoutTop.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@

<body>


<div id="content_top" style="margin: 0;padding: 0;">
${param.PARAM_CONTENT}
</div>


<c:import url="/WEB-INF/views/commons/layout/commonFooter.jsp" />
Expand Down
32 changes: 31 additions & 1 deletion src/main/webapp/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,34 @@ body {

.menu_list li {
margin-top: 10px;
}
}


.pagetop {
display: none;
position: fixed;
bottom: 30px;
right: 30px;
}
.pagetop a {
display: block;
background-color: #ccc;
text-align: center;
color: #222;
font-size: 12px;
text-decoration: none;
padding: 20px 10px;
}

.pagetop a:hover {
display: block;
background-color: #222;
text-align: center;
color: #fff;
font-size: 12px;
text-decoration: none;
padding:20px 10px;
}



17 changes: 17 additions & 0 deletions src/main/webapp/js/common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$(document).ready(function() {
var pagetop = $('.pagetop');
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
pagetop.fadeIn();
} else {
pagetop.fadeOut();
}
});
pagetop.click(function() {
$('body, html').animate({
scrollTop : 0
}, 500);
return false;
});

});

0 comments on commit 050f406

Please sign in to comment.