Skip to content

fix: initialize slider when DOM is already ready#53

Open
leno23 wants to merge 1 commit into
brainstormforce:masterfrom
leno23:fix/slider-ready-state-init
Open

fix: initialize slider when DOM is already ready#53
leno23 wants to merge 1 commit into
brainstormforce:masterfrom
leno23:fix/slider-ready-state-init

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • replace the slider block's nested DOMContentLoaded listener with a ready-state aware initializer
  • keep the Swiper variable scoped inside an IIFE
  • allow the generated frontend script to initialize whether it is wrapped by the post-assets loader or executed after DOM readiness

Test plan

  • php -l /tmp/wp-spectra-slider-frontend.patched.php
  • git diff --no-index --check /tmp/wp-spectra-slider-frontend.orig.php /tmp/wp-spectra-slider-frontend.patched.php

Fixes #52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slider Block Never Initializes on the Frontend - Swiper Init Double-Wrapped in DOMContentLoaded

1 participant