mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-15 21:04:34 +02:00
Added back to top button.
This commit is contained in:
parent
32a54293a5
commit
528be3c000
2 changed files with 31 additions and 0 deletions
|
@ -128,6 +128,28 @@ $(document).on("ajaxUI:start ajaxUI:reload", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the button, to jump to the top of the page.
|
||||||
|
*/
|
||||||
|
$(document).on("ajaxUI:start", function registerJumpToTop() {
|
||||||
|
$(window).scroll(function () {
|
||||||
|
if ($(this).scrollTop() > 50) {
|
||||||
|
$('#back-to-top').fadeIn();
|
||||||
|
} else {
|
||||||
|
$('#back-to-top').fadeOut();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// scroll body to 0px on click
|
||||||
|
$('#back-to-top').click(function () {
|
||||||
|
$('#back-to-top').tooltip('hide');
|
||||||
|
$('body,html').animate({
|
||||||
|
scrollTop: 0
|
||||||
|
}, 800);
|
||||||
|
return false;
|
||||||
|
}).tooltip();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//Need for proper body padding, with every navbar height
|
//Need for proper body padding, with every navbar height
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
let height : number = $('#navbar').height() + 10;
|
let height : number = $('#navbar').height() + 10;
|
||||||
|
|
|
@ -262,6 +262,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{
|
||||||
|
|
||||||
|
{# Back to top buton #}
|
||||||
|
|
||||||
|
<!-- Back to top button -->
|
||||||
|
<a id="back-to-top" href="#" class="btn btn-primary back-to-top" data-no-ajax role="button"
|
||||||
|
title="{% trans %}back_to_top{% endtrans %}" data-toggle="tooltip" data-placement="left">
|
||||||
|
<i class="fas fa-angle-up fa-fw"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue