PageSourceSearch

https://museusdesitges.cat/blog/wp-content/plugins/my-css/my_scripts.js?ver=1.0.8

js museusdesitges.cat collected 2026-10-02 11:05:25 UTC 994 bytes, 33 lines download raw bytes

1// My JS
2
3/*
4- create a script to add a button "go to top" to the current HTML page
5- the button is shown when the user scrolls down 200px from the top of the document
6- the button is a div with a class name "go-to-top", with a text "Go to top"
7- the buton is inicially hidden
8*/
9
10// usin jQuery add the button to the body of the page: <div class="go-to-top">Go to top</div>
11
12jQuery(document).ready(function($) {
13    var $button = $('<div class="go-to-top">&uarr;</div>');
14    $('body').append($button);
15
16    // hide the button
17    $button.hide();
18
19    // show the button when the user scrolls down 200px from the top of the document
20    $(window).scroll(function() {
21        if ($(this).scrollTop() > 200) {
22            $button.fadeIn();
23        } else {
24            $button.fadeOut();
25        }
26    });
27
28    // scroll to the top of the document when the button is clicked
29    $button.click(function() {
30        $('html, body').animate({ scrollTop: 0 }, 600);
31        return false;
32    });
33});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.