Skip to content

Commit c9f22e3

Browse files
authored
add go to top arrow (#675)
1 parent ae090d9 commit c9f22e3

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

_layouts/bootstrap.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,12 @@ <h4 class="mt-8">additional_thanks_to_</h4>
317317
<!-- Google Tag Manager (noscript) -->
318318
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-KW4XGH4"
319319
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
320-
<!-- End Google Tag Manager (noscript) -->
321-
320+
<!-- End Google Tag Manager (noscript) -->
321+
322+
<div class="scroll-to-top" id="scroll-to-top" style="display: none">
323+
<svg xmlns="http://www.w3.org/2000/svg" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd" viewBox="0 0 512 312.36"><path fill-rule="nonzero" d="M0 276.77 253.12 0 512 282.48l-32.65 29.88-226.2-246.83L32.66 306.64z"/></svg>
324+
</div>
325+
322326
{% include js.html %}
323327

324328
{% include twitter.html %}

_scss/_main.scss

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,4 +1765,23 @@ body #footer .links {
17651765
margin-left: 0 !important;
17661766
margin-bottom: 20px;
17671767
}
1768-
}
1768+
}
1769+
1770+
.scroll-to-top {
1771+
width: 50px;
1772+
height: 50px;
1773+
border-radius: 50%;
1774+
font-size: 30px;
1775+
text-align: center;
1776+
color: #236BFD;
1777+
background-color: #ffffff;
1778+
position: fixed;
1779+
bottom: 50px;
1780+
right: 50px;
1781+
cursor: pointer;
1782+
svg {
1783+
width: 20px;
1784+
height: 20px;
1785+
fill: #236BFD;
1786+
}
1787+
}

js/scripts.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ $(document).ready(function () {
9191
$('#contributors').append('<p style="clear: both">Join us, fork Codeception and submit your pull requests!</p>');
9292
}
9393
});
94+
95+
$('#scroll-to-top').click(function () {
96+
$('html, body').animate({scrollTop: 0}, 400);
97+
return false;
98+
});
99+
100+
$(window).scroll(function () {
101+
var threshold = 300;
102+
if ($(window).scrollTop() > threshold) {
103+
$('#scroll-to-top').fadeIn('slow');
104+
} else {
105+
$('#scroll-to-top').fadeOut('slow');
106+
}
107+
});
94108
});
95109

96110
// js

js/scripts.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)