Stayrail – Sticky Widgets & Elements

Description

Stayrail keeps your most important content in view: sidebar ads, sign-up forms, tables of contents, calls to action or anything else you choose.

It is a modern, actively maintained alternative to the “Fixed Widget” (Q2W3) plugin, and it can import your existing Fixed Widget setup in one click.

Three ways to make something sticky

  • Blocks – select any block in the editor, site editor or block widget editor and switch on “Keep sticky while scrolling”.
  • Classic widgets – tick “Keep sticky while scrolling” on any widget under Appearance Widgets.
  • Anything else – add a CSS selector in the settings, or give an element the class stayrail-sticky. Works with page builders such as Elementor, Divi, Bricks and Brizy.

Built to just work

  • Stable width when zooming, resizing or rotating the screen.
  • Zero layout shift: a placeholder keeps the element’s spot in the page.
  • Automatically stays below the admin bar and sticky headers.
  • Automatically stops at the site footer, plus your own stop elements.
  • Several sticky widgets in one sidebar stack neatly.
  • Choose desktop, tablet and/or mobile, with your own breakpoints.
  • Elements taller than the screen scroll until their bottom is reached, then stick.
  • Plain JavaScript, no jQuery. Script loads deferred.
  • Translation-ready. Norwegian (bokmål) included.

Switching from Fixed Widget

Activate Stayrail and you’ll see an import notice. One click copies your margins, stop elements, custom elements, minimum screen size and every widget you had marked as fixed. Then deactivate Fixed Widget.

For developers

  • window.Stayrail.refresh() – re-scan the page after loading content with JavaScript (infinite scroll, AJAX).
  • document.dispatchEvent( new Event( 'stayrail:refresh' ) ) – same, event-based.
  • data-stayrail-devices="desktop,tablet" – per-element device override.
  • data-stayrail-after="30" – only stick after 30 % of the page has been scrolled.
  • .stayrail-is-stuck – class added while an element is pinned.
  • stayrail:stuck / stayrail:released – events fired on the element when it is pinned or released.
  • stayrail_frontend_config – filter the configuration sent to the script.

External services

Stayrail includes the Freemius SDK, which is used only to sell and license the optional Stayrail Pro add-on. It runs in anonymous mode: the free plugin shows no opt-in screen and sends no data on its own.

Data is sent to Freemius (https://freemius.com) only if you choose to opt in from the Plugins screen, or when you buy or activate Stayrail Pro. In that case Freemius receives your site address, WordPress and plugin versions, and the admin e-mail and name used for the license. Freemius terms: https://freemius.com/terms/ – privacy policy: https://freemius.com/privacy/

Screenshots

Installation

  1. Install and activate the plugin.
  2. Go to Settings Stayrail.
  3. Make a block, widget or element sticky using one of the three methods above.

FAQ

The sticky element doesn’t stick.

Check that the device type is enabled under Devices, and that your browser window is wider than the minimum width (if set). Clear your page cache after changing settings.

The element ends up behind other content.

Raise the layer (z-index) under Advanced.

Does it work with caching and optimization plugins?

Yes. The script has no dependencies and can be deferred or combined.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“Stayrail – Sticky Widgets & Elements” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

0.5.0

  • Translations now come from translate.wordpress.org.

0.4.0

  • Prepared for Stayrail Pro through Freemius (anonymous mode, no data sent by default).

0.3.0

  • New events: stayrail:stuck and stayrail:released on pinned elements.

0.2.0

  • Per-element rules via data attributes (devices, scroll depth).
  • Extension points for add-ons on the settings screen.

0.1.0

  • First release.