Files
xrpl-dev-portal/content/static/js/jump-to-top.js
mDuo13 e4ceb8b37b Temporary: move static files into content
During migration, while we launch Redocly with -d content, the static
files need to be in content. Eventually, when we stop using -d, we need
to move the files again.

Previously:
/assets : static assets used by templates
/img : images used in documentation (mostly)

Now:
/content/static : static assets used by templates
/img : images used in documentation (mostly)

Eventually:
/static : static assets used by templates
/docs/img : images used in documentation
2024-01-31 16:04:58 -08:00

26 lines
743 B
JavaScript

$(document).ready(function() {
var TO_TOP_MIN = 50;
var TO_TOP_SPEED = 500;
var TO_TOP_POS = 0;
$(window).scroll(function () {
if ($(this).scrollTop() > TO_TOP_MIN) {
$('.jump-to-top').fadeIn();
} else {
$('.jump-to-top').fadeOut();
}
});
$(".jump-to-top").click(function() {
$("html").animate({scrollTop: TO_TOP_POS}, TO_TOP_SPEED)
});
// TODO: put this somewhere better.
// Code to make other menu items hide on mobile when we expand one
$("#topnav-pages .dropdown").on("show.bs.dropdown", (evt) => {
$("#top-main-nav").addClass("submenu-expanded")
})
$("#topnav-pages .dropdown").on("hidden.bs.dropdown", (evt) => {
$("#top-main-nav").removeClass("submenu-expanded")
})
});