Viewing 5 replies - 1 through 5 (of 5 total)
  • Theme Author Sami Keijonen

    (@samikeijonen)

    You can try background-attachment: fixed CSS rule.

    Thread Starter Swissprice

    (@swissprice)

    Hello,

    Thank you for your reply. It worked perfectly!

    In case anyone need this, here’s the exact code I used :

    header {
    background-attachment: fixed ! important;
    }

    Note that it’ll zoom the image and it’s normal. The best solution is to add a bigger image and don’t crop it.

    Thread Starter Swissprice

    (@swissprice)

    One more thing:

    On mobile, the image stayed zoomed and the parallax effect disappeared so I added the following:

    @media only screen and (max-width: 800px) {

    header {
    background-attachment: scroll !important;
    }

    It’ll show the entire header image (no zoom) and will scroll with the content.

    PS: don’t forget to use a child theme

    Theme Author Sami Keijonen

    (@samikeijonen)

    Note that on mobile phones scroll effect won’t work:) I’d also switch header element to .site-header class:

    .site-header {
    background-attachment: fixed ! important;
    }
    Thread Starter Swissprice

    (@swissprice)

    Ok thanks you for your reply. I’ll change this. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Parallax effect on header image’ is closed to new replies.