Site logo

Archived topic

Mobile header problem

11 replies · Started by Karel on May 17, 2019

Viewing posts 1–12 of 12

Hello guys,

I've added this code and write "parallax" into elements classes

.parallax {
background-position: center bottom !important;
background-attachment: fixed;
}

In a desktop version, it is working perfectly, the problem is with a mobile version because an image is " pushed out " when I add text.

Is there any solution how to make the header image static on the mobile version?

Hi there,

Not quite sure if I understand.

What do you mean that it's pushed out?

Sometimes it's much easier to have a specific background image for mobile:

@media (max-width: 768px) {
    .home .page-hero {
        background-image: linear-gradient(0deg, rgba(0,0,0,0.12),rgba(0,0,0,0.12)), url(https://MOBILE-BACKGROUND-IMAGE-HERE);
    }
}

By “pushed out” I've meant that without any content a header image is okey, but when I publish anything the image is moving.

As you can see here:
https://imgur.com/a/fWZBOaF

Yes I did, I added even more content now, and the header image has moved again.

I would like to have it as a static image.

without that code above it is looking like I want.
https://imgur.com/a/kfeD4Qy

Yes, but I cannot find the way how to do it.

Find a way to do what?

If you want to use a fixed background image, shouldn't the parallax be turned off?

No, I did not find a way.

I tried to use this code:

@media (max-width:768px) {
.fake-para {
background-position: center top !important;
background-size: contain;
}}

and then played with padding for a mobile version, but a problem was that the image wasn't always same sized. It didn't look good.

If you want to use a fixed background image, shouldn’t the parallax be turned off?

Parallax feature is turned OFF in elements.

I think I have just solved the problem now, it was kinda confusing because as we were writing I was still trying to play with code ...

thank you anyway :)

No problem :)

This archived topic is closed to new replies.