Opened 5 weeks ago
Last modified 5 weeks ago
#63251 new enhancement
Twenty Fourteen: implement slider feature with CSS carousel
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Bundled Theme | Keywords: | has-patch |
Focuses: | performance | Cc: |
Description
New features in the CSS Overflow 5 specification have been designed to create scroll and carousel experiences with built-in accessibility and better performance.
While learning more about these new capabilities, I figured that the Twenty Fourteen could benefit from this.
The theme could use the new CSS carousel feature in supporting browsers, falling back to the existing JavaScript/jQuery slider. In a supporting browser, this would avoid loading over 18 KB of JavaScript!
Change History (5)
This ticket was mentioned in PR #8352 on WordPress/wordpress-develop by @swissspidy.
5 weeks ago
#1
#2
@
5 weeks ago
- Summary changed from Twenty Fourteen: implement slider feature with CSS carousesl to Twenty Fourteen: implement slider feature with CSS carousel
#3
@
5 weeks ago
As Twenty Fourteen is a classic theme, child themes (and/or plugins) can replace templates, CSS and scripts.
I doubt this is complete, but I can think of some adjustments to account for child themes:
- The script probably should check for the existence of
data-
attributes from each template, in addition to the.slider
class and CSS support. - The new CSS could use
wp_add_inline_style()
because a child theme would replacestyle.css
by default. (Enqueuing the parent stylesheet is recommended, not required.)
In supporting browsers, the carousel is built using CSS only. The
slider.js
script (19 KB) is not loaded. This saves some bandwidth.If the browser doesn't support the feature, the
slider.js
script is loaded on demand.Not implemented in the CSS version: cyclic/infinite carousel. This currently requires some JavaScript still, but I think this could be just as well omitted as it doesn't seem critical for this feature.
Demo:
https://github.com/user-attachments/assets/4d9aee53-1c97-4099-9e04-6c190d840feb
Trac ticket: https://core.trac.wordpress.org/ticket/63251