Skip to content

Commit 01505cd

Browse files
committed
Add button to navigate back to the top of the list.
1 parent 8a56fae commit 01505cd

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

assets/static/script.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
$(document).ready(function() {
2+
$(window).scroll(function() {
3+
if ($(this).scrollTop() > 500) {
4+
$('#back-to-top').fadeIn();
5+
} else {
6+
$('#back-to-top').fadeOut();
7+
}
8+
});
9+
});

assets/static/style.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@
2929
border-width: 10px;
3030
padding-left: 0px;
3131
font-size: 1.5em;
32-
}
32+
}
33+
34+
#back-to-top {
35+
cursor: pointer;
36+
position: fixed;
37+
bottom: 20px;
38+
right: 20px;
39+
display: none;
40+
background-color: #00b5da;
41+
border: none;
42+
}

templates/layout.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
<meta charset="utf-8">
33
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
44
<link rel="stylesheet" href="{{ '/static/style.css'|url }}">
5-
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
5+
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
66
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
77
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
8+
<script type="text/javascript" src="{{ '/static/script.js'|url }}"></script>
89
<title>{% block title %}Welcome{% endblock %} — Creative Commons on GitHub</title>
910
<body>
1011
<header>

templates/project-ideas-page.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
{% block title %}{{ this.title }}{% endblock %}
33

44
{% block body %}
5-
<h1>Google Summer of Code 2019 Project Ideas</h1>
5+
<a name="ideas-top"><h1>Google Summer of Code 2019 Project Ideas</h1></a>
66
{% set ideas = site.query('/project-ideas-page/project-ideas').include_undiscoverable(true).all() %}
77
<div class="mt-4">
88
<div>
9-
<p>The following list contains Creative Commons proposed ideas for the Google Summer of Code 2019</p>
10-
119
<ul class="list-unstyled m3">
1210
{% for idea in ideas %}
1311
<li class="my-2"><a href="#{{ idea._slug }}">{{ idea.title }}</a></li>
@@ -28,5 +26,6 @@ <h2 class="card-header"><a name="{{ idea._slug }}">{{ idea.title }}</a></h5>
2826
</ul>
2927
</div>
3028
{% endfor %}
29+
<a id="back-to-top" href="#ideas-top" class="btn btn-dark btn-sm" role="button">Back to list</a>
3130
</div>
3231
{% endblock %}

0 commit comments

Comments
 (0)