Cover block parallax style — v1.2.0

,

The first version of Cover Block Parallax Style was a pretty simple idea: add a smooth parallax scrolling effect to the native WordPress Cover block without requiring custom blocks or shortcodes. Toggle it on, pick a speed, done.

v1.2.0 is less about new features and more about fixing things that were quietly broken.

What got fixed

The most embarrassing bug: the editor and frontend were using different default speeds. The editor defaulted to 0.3; the frontend fell back to 0.5 if the data attribute was missing. So what you saw in the editor wasn’t what visitors got. Both are 0.3 now.

There were also two related bugs around mobile handling. The original approach ran a mobile check once at page load and exited the entire script early if the viewport was narrow. That meant if you loaded the page on a phone and then resized to a desktop window, parallax never initialized. The resize handler made things worse — it removed the scroll listener when switching to mobile, then called initParallax() on the way back to desktop without ever re-attaching it. Both got fixed by moving the mobile check into the per-block initialization logic instead of using it as a global gate.

One more: the editor used setTimeout polling to find the iframe it needed, with no retry limit. That loop would run forever if WordPress ever changed the iframe name. It’s now capped at 60 retries.

What’s new

The main addition is a per-block “Disable on mobile” toggle. Previously, parallax was globally disabled at ≤768px for every block on the page. Now it’s on by default at all viewport sizes, and you can opt individual blocks out. If you want a specific Cover block to fall back to a static background on mobile while other parallax blocks stay active, that’s now possible.

The background oversizing also increased from 130% to 140%. At maximum speed, 130% left no margin for sub-pixel rounding, which could produce a hairline gap at the edge of the block. 140% matches what production parallax libraries like Rellax and GSAP ScrollTrigger use.

One small performance fix: the frontend script was loading in the <head> as a render-blocking resource. Since it already handles DOMContentLoaded gracefully, it now loads in the footer where it belongs.

Repo cleanup

A few things that were wrong from the start got corrected. Build-only dependencies (@babel/runtime, @wordpress/icons) were listed in dependencies instead of devDependencies. The build/ directory was committed to the repo while src/ was being tracked alongside it; that’s backwards for an open-source project. Build output is now gitignored; contributors run npm run build to generate it. The plugin header also pointed to the wrong GitHub org.


Download v1.2.0 — or grab the full release on GitHub.


One response

  1. WordCamp Asia, Block Themes, AI in WordPress, WooCommerce 10.7- Weekend Edition 363 – Gutenberg Times

    […] Hanson‘s Cover Block Parallax Style v1.2.0 is more bug-fix than feature release. The most visible fix: the editor and frontend were using […]

Leave a Reply

Your email address will not be published. Required fields are marked *