বিষয়বস্তুতে চলুন

ব্যবহারকারী:R1F4T/ToTop&BottomButton.js

উইকিপিডিয়া, মুক্ত বিশ্বকোষ থেকে

লক্ষ্য করুন: প্রকাশ করার পর, পরিবর্তনগুলো দেখতে আপনাকে আপনার ব্রাউজারের ক্যাশে পরিষ্কার করার প্রয়োজন হতে পারে।

  • ফায়ারফক্স / সাফারি: পুনরায় লোড-এ ক্লিক করার সময় শিফট টিপে ধরে রাখুন, অথবা হয় Ctrl-F5 বা Ctrl-R টিপুন (ম্যাকে ⌘-R টিপুন)
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাকে ⌘-Shift-R) টিপুন
  • এজ: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 টিপুন।
  • অপেরা: Ctrl-F5 টিপুন।
// Adds a floating "scroll to bottom" button on the bottom-right of the screen
// Documentation at [[en:w:User:BrandonXLF/TopButton]]
// By [[en:w:User:BrandonXLF]]

$(function() {
    mw.loader.load('https://bn.wikipedia.org/wiki/User:R1F4T/ToTop&BottomButton.css?action=raw&ctype=text/css', 'text/css');

    var circle = $('<div>')
        .appendTo('body')
        .addClass('topButtonCircle') // Changed the class name for clarity
        .on('click', function() {
        	$('html').animate({scrollTop: $(document).height()});
            const scrollingElement = document.scrollingElement || document.body;
            scrollingElement.scrollTop = scrollingElement.scrollHeight;
        })
        .append('<div></div>');

    $(window).scroll(function() {
        if ($(window).scrollTop() > 100) {
            circle.fadeIn();
        } else {
            circle.fadeOut();
        }
    });
});