hk2/scrolltop

Scroll Top adds an intuitive icon at the bottom-right corner of each page so that with one click you will be at the top of the page. No more dragging of the scroll bar. It will be just fun and ergonomic to use. Scroll Top is an uncomplicated free Open Source Magento Module allowing site visitors to

Maintainers

Package info

github.com/basantmandal/magento2-scrolltop-module

Language:Shell

Type:magento2-module

pkg:composer/hk2/scrolltop

Transparency log

Statistics

Installs: 10

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v2.1.0 2026-07-16 14:27 UTC

This package is auto-updated.

Last update: 2026-07-16 14:28:07 UTC


README

Version License Magento PHP Downloads

Overview

HK2 Scroll Top is an uncomplicated free Open Source Magento Module that adds an intuitive back-to-top button at the corner of each page. It allows visitors to seamlessly navigate back to the top of lengthy web pages.

🎯 Use Cases

  • Enhanced UX: Enhances storefront ergonomics on content-heavy pages like catalogs, blog indexes, or long details screens.
  • Mobile Usability: Saves mobile users from tedious scrolling gestures.

🚀 Features

  • ⚡ Seamless scroll animation on clicking the back-to-top button.
  • ⚙️ Configurable button offset in pixels before it fades in.
  • ⏱ Configurable scroll speed in milliseconds.
  • 📍 Multiple position options (Bottom Right, Bottom Left, Top Right, Top Left).
  • 🎨 Lightweight, native JS initialization utilizing Magento's standard data-mage-init system.

🏗 Architecture

  • Block: HK2\ScrollTop\Block\ScrollTop encodes configuration as JSON for frontend integration.
  • Helper: HK2\ScrollTop\Helper\Data reads configuration and handles scope fallbacks.

🧩 Magento Components

Blocks

  • HK2\ScrollTop\Block\ScrollTop

Helpers

  • HK2\ScrollTop\Helper\Data

Layout XML

  • view/frontend/layout/default.xml - Injects CSS stylesheet asset and template block.

📦 Requirements

  • Magento version: 2.4.4 - 2.4.9
  • PHP requirements: 8.1 || 8.2 || 8.3 || 8.4
  • Required Extension: HK2_Core

⚙️ Installation

  1. composer require hk2/scrolltop
  2. bin/magento module:enable HK2_ScrollTop
  3. bin/magento setup:upgrade
  4. bin/magento setup:di:compile
  5. bin/magento cache:flush

🔧 Configuration

Configure settings under Stores > Configuration > HK2 > Scroll Top:

Field Description
Enable ScrollTop Button Enable or disable the button on the storefront.
Button Position Placement options: Bottom Right, Bottom Left, Top Right, Top Left.
Scroll Offset (px) Vertically scrolled pixels before the button appears (default: 20).
Scroll Speed (ms) Duration of the scroll to top animation in milliseconds (default: 600).

Usage

Once enabled, scroll down any frontend storefront page beyond your configured offset. Click the arrow button to slide back to the top of the page.

🗄 Database Changes

Not Applicable

📂 Module Structure

Block/
└── ScrollTop.php
Helper/
└── Data.php
Model/
└── Config/
    └── Source/
        └── Position.php
etc/
├── adminhtml/
│   ├── menu.xml
│   └── system.xml
├── frontend/
│   └── di.xml
├── acl.xml
├── config.xml
└── module.xml
view/
└── frontend/
    ├── layout/
    │   └── default.xml
    ├── templates/
    │   └── scrolltop.phtml
    └── web/
        ├── css/
        │   └── scrollTop.css
        └── js/
            └── scroll-top.js

📈 Performance Considerations

The JS component executes outside layout recalculations, utilizing basic fade effects to keep storefront interaction fluid.

🔐 Security Considerations

  • Secure Config Paths: Custom administrative ACL is defined under HK2_ScrollTop::core_config in etc/acl.xml.

Compatibility

Reference: docs/compatibility.md

Platform Supported Versions
Magento 2.4.4 - 2.4.9
PHP 8.1, 8.2, 8.3, 8.4

🛠 Troubleshooting

Button does not appear on scroll

Ensure that you scroll past the offset value defined in configuration (default 20px). Verify that the cache is flushed: bin/magento cache:flush.

🤝 Contributing

Contributions are welcome! If you'd like to improve the installer:

  • Star this repository (Helps others find it!)
  • 🍴 Fork the project
  • 🐛 Report bugs
  • 💡 Suggest new features
  • 🤝 Contribute improvements

Every ⭐ helps increase the visibility of the project and motivates further development.

⚖️ Disclaimer

The author provides this installation script "as is" without any warranties. Users are responsible for ensuring that running this script complies with their internal security and software requirements.

🤝 Support

For bug reports, feature requests, and general support:

License

This project is licensed under the OSL 3.0 License. See the LICENSE.txt file for details.