[Resolved] Parallax on Featured Image

Home Forums Support [Resolved] Parallax on Featured Image

Home Forums Support Parallax on Featured Image

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1641924
    Joel

    Hello, is it possible to apply the parallax effect to a Featured Image (not a Background Image)? I’m wondering whether the GP parallax.js can be tweaked to use object-position instead of backgroundPositionY?

    I want to do this to benefit from srcset which doesn’t work on a background image.

    Thanks

    #1642244
    Elvin
    Staff
    Customer Support

    Hi there,

    I’m not sure I fully understand what you mean.

    The parallax script was written for the background-image property.

    Are you trying to apply it on a specific <img> element (featured image)? If so that’s quite tricky to do as you’ll have to control the <img> actually position on the page and it this may potentially cause CLS issues.

    If I may suggest:

    You can make the <img> tag behave like a background-image by setting its position to “absolute” and it’s parent element to “relative” with a defined height.

    You then apply the script that “parallaxes” its top or bottom position.

    As for providing the actual custom script, this kind of site customization is outside of our scope, unfortunately.

    A wise man once said:
    "Have you cleared your cache?"

    #1642456
    Joel

    Thanks Elvin, I’ll give that a shot. Yes I was trying to apply the parallax effect to a specific image but hadn’t considered CLS issues. And apologies, I thought it was worth asking in case you already had some script ๐Ÿ™‚

    Thanks again

    #1643593
    Elvin
    Staff
    Customer Support

    No problem. ๐Ÿ™‚

    A wise man once said:
    "Have you cleared your cache?"

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.