ForumSpark Support app Faster, straight from your home screen. Tap Share, then Add to Home Screen.
Add ForumSpark Support to your home screen
  1. Tap Share at the bottom of Safari.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. ForumSpark Support now opens like an app.
  1. Tap Install, or open the browser menu.
  2. Choose Install app or Add to Home screen.
  3. Confirm. ForumSpark Support now opens like an app.

Go to Top Button

Cedric's Avatar
Cedric · in Themes & Extensions
3 replies 180 views

This goes into your Below the Board template. You can adjust the style of the button using CSS between the <style> tags.

Preview: https://prnt.sc/J5TmePMR9D3z

<style>
        #goTopBtn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            display: none;
            background: #1a152c;
            color: white;
            border: none;
            border-radius: 5px;
            padding: 10px;
            font-size: 18px;
            cursor: pointer;
        }
    </style>

<button id="goTopBtn" onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">Top</button>

<script>
    const goTopBtn = document.getElementById('goTopBtn');
    window.addEventListener('scroll', () => {
        goTopBtn.style.display = window.scrollY > 200 ? 'block' : 'none';
    });
</script>

Love it! Do you think it'll be added as part of the default coding eventually?

Honestly it's not something I was intending to include, I really saw this as something for theme developers to (choose to) include in their themes. But if there is a demand for it to be included and people would prefer it as a default feature then it wouldn't hurt to add it in.

I made a few edits 🙂

I removed the text, added an arrow icon, and fixed the issue where it was going under the copyright footer div. It was appearing underneath it for me before, but now it sits correctly above it.

<style>
#goTopBtn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#2b1f4a,#1a152c);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 9999;
    box-shadow: 0 0 10px rgba(120,90,255,0.3);
}

#goTopBtn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#goTopBtn:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 18px rgba(140,110,255,0.6);
    background: linear-gradient(135deg,#3a2a6a,#241c3f);
}
</style>

<button id="goTopBtn" onclick="window.scrollTo({ top: 0, behavior: 'smooth' });">
↑
</button>

<script>
const goTopBtn = document.getElementById('goTopBtn');

window.addEventListener('scroll', () => {
    if (window.scrollY > 200) {
        goTopBtn.classList.add("show");
    } else {
        goTopBtn.classList.remove("show");
    }
});
</script>

Last edited by empire

"Please remain seated. The captain has absolutely no idea what he’s doing."

You might also like...

Topic Replies Views Last reply
Boo & Co Popular in Themes & Extensions, started by Cedric, 2 months ago
19 555
Cedric's Avatar
Cedric4 days ago
Horizon Popular in Themes & Extensions, started by Cedric, 3 months ago
9 281
Cedric's Avatar
Cedric3 months ago
Quests Popular in Themes & Extensions, started by Cedric, 2 days ago
8 284
Cedric's Avatar
Cedric10 hours ago
Classifieds Popular in Themes & Extensions, started by Cedric, 2 days ago
7 260
Cedric's Avatar
Cedric1 day ago
Flurry Popular in Themes & Extensions, started by Cedric, 2 months ago
6 240
Cedric's Avatar
Cedric2 months ago