|
|
| (не показано 7 промежуточных версий этого же участника) |
| Строка 164: |
Строка 164: |
| } | | } |
| } | | } |
|
| |
| $('body').prepend('<a href="#" class="back-to-top">Back to Top</a>');
| |
|
| |
| var amountScrolled = 300;
| |
|
| |
| $(window).scroll(function () {
| |
| if ($(window).scrollTop() > amountScrolled) {
| |
| $('a.back-to-top').fadeIn('slow');
| |
| } else {
| |
| $('a.back-to-top').fadeOut('slow');
| |
| }
| |
| });
| |
|
| |
| $('a.back-to-top, a.simple-back-to-top').click(function () {
| |
| $('html, body').animate({
| |
| scrollTop: 0
| |
| }, 'slow');
| |
| return false;
| |
| });
| |
|
| |
|
| |
| import { computePosition } from "@floating-ui/dom";
| |
|
| |
| const reference = document.getElementById("reference");
| |
| const floating = document.getElementById("floating");
| |
|
| |
| computePosition(reference, floating, {
| |
| // Try changing this to a different side.
| |
| placement: "top"
| |
| }).then(({ x, y }) => {
| |
| Object.assign(floating.style, {
| |
| top: `${y}px`,
| |
| left: `${x}px`
| |
| });
| |
| });
| |