Directory / plugin

Quicksloth Sticky Widget – Fixed Widgets, Blocks & Sticky Sidebar

v1.0.1 · by quicksloth

Sticky widgets, blocks and sidebar elements that stay in view and stop before the footer. Keeps your existing Fixed Widget settings. No jQuery.

About this plugin

Keep a sidebar widget, a block or any element of your theme in view while visitors scroll down a long page, and stop it before the footer instead of covering it. Works with classic widgets, with any block (WordPress’s own Sticky setting covers only Group blocks, on themes that turn it on) and with any element you point to with a CSS selector.

How to make something sticky

  • Classic widget: under Appearance Widgets, open the widget and tick Sticky (stays in view while scrolling).
  • Block: select it and turn on Sticky in the Sticky panel of the block settings, in the post, site and block widgets editors. Stop here marks a block that sticky blocks must not cover.
  • Block theme (no Appearance Widgets): under Appearance Editor, select a block in a template or template part and turn on Sticky.
  • Any other element: list its ID, class or tag under Custom sticky elements on the settings page, one per line.

Settings

One page under Appearance Sticky Widget (also from the Settings link on the Plugins screen):

  • Margin top (10 px by default) and Margin bottom (0): distance from the window edges and from stop elements.
  • Stop elements: selectors of elements that push the sticky element up, one per line. Also stop before the theme footer (footer, #colophon, .site-footer) is on by default.
  • Custom sticky elements: selectors of other elements that should stay in view.
  • Minimum screen width and Minimum screen height: below these window sizes nothing is sticky (0 = no limit).
  • Devices: Desktop, Tablet, Phone. Phone is a window under 768 px, tablet 768 to 1024 px, desktop above.
  • Layer (z-index), 50 by default: raise it if a sticky element hides behind the content, lower it if it covers a fixed header.

Coming from Fixed Widget

On activation the plugin imports your Fixed Widget (q2w3) settings automatically: margins, stop elements, custom elements (bare IDs of version 5 included) and minimum width and height. Widgets ticked as fixed there, and blocks with its FixedWidget__fixed_widget and FixedWidget__stop_widget classes, stay sticky without a click. Its settings are never changed or deleted, so you can switch back. While it is still active this plugin keeps its script off (two scripts would make the same widgets jump) and the settings page says so; deactivate it and everything starts by itself.

How it is built

  • position: sticky where the column allows it; otherwise a fixed-position fallback with a placeholder that recalculates the width on zoom, resize and rotation.
  • Several sticky elements in one column stack 10 px apart. An element taller than the window is left alone: pinned, it would hide its own end.
  • One script of about 5 KB compressed, loaded only on pages that have a sticky element. No jQuery, no extra CSS, no external requests, no cookies.
  • No top-level menu and no dashboard notices, except one review request after 14 days, gone for good once you answer it.

Tested with

Twenty Twenty-Five, Twenty Twenty-One, Astra, GeneratePress, Kadence and OceanWP; Chromium, Firefox and WebKit (the engine of Safari); zoom from 50 to 200%; window widths from 1280 to 800 px; LiteSpeed Cache 7.9.2 with JavaScript and CSS combined and deferred.

What this plugin does not do

Sticky headers and menus, notification bars and popups: other plugins do that.

Privacy

This plugin does not collect, send or share any personal data. No cookies, no tracking, no telemetry and no requests to external servers, on your site or in your dashboard.

On your server it stores its settings (one option), the date of the first activation and your answer to the review request, plus the Sticky tick in your widgets and the qssw attribute in your blocks. Deleting the plugin removes the options and the tick from the widgets in use; it never touches the data of Fixed Widget. The attribute stays in the block content and does nothing without the plugin.

Plugin tags