Skip to content

Add parallax effect to masthead - #116

Open
brettfxio wants to merge 1 commit into
masterfrom
masthead-parallax-effect-5688058831080564667
Open

Add parallax effect to masthead#116
brettfxio wants to merge 1 commit into
masterfrom
masthead-parallax-effect-5688058831080564667

Conversation

@brettfxio

Copy link
Copy Markdown
Contributor

This change adds a parallax effect to the masthead for any page with a masthead image. It uses a hybrid approach:

  • CSS-only: background-attachment: fixed is applied to header.masthead for screens 768px and wider, providing a smooth, native effect where supported.
  • JavaScript Fallback: An optimized scroll listener in assets/js/app.js dynamically adjusts the background position for smaller screens or where the CSS-only effect is disabled.

The implementation was optimized to avoid unnecessary layout reflows and only runs on pages with a masthead.


PR created automatically by Jules for task 5688058831080564667 started by @brettfxio

- Update `_sass/layout/_masthead.scss` to use `background-attachment: fixed` for screens 768px and wider.
- Implement an optimized JavaScript-driven parallax effect in `assets/js/app.js` for screens where fixed background attachment is not applied.
- Ensure the effect is only active on pages containing a `.masthead` element.
- Optimize performance by caching DOM elements and moving expensive checks outside the scroll listener.

Co-authored-by: brettfxio <105930054+brettfxio@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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.

1 participant