- This topic has 34 replies, 9 voices, and was last updated 4 years, 6 months ago by
David.
-
AuthorPosts
-
August 7, 2015 at 9:19 am #127378
Tom
Lead DeveloperLead DeveloperPerfect, glad you got it sorted π
February 3, 2017 at 5:21 am #273769Sarah
I can’t get this to work with parallax!
https://sarahcairncross.com/welcome/
Well, I’ve got it to work for desktop and mobile view but not tablet, for some reason in Customiser it is showing only to the bottom of my nose haha.
Also, on portrait in mobile view it is repeating the image as I scroll down the page. I have set the padding to 350px top and bottom in the section.
I did try creating this using the Page Header with parallax but I got the the repeat on all views. Is the problem the dimensions of my image? Is there an optimum image size for a background image?
Any pointers would be FAB! Thank you in advance Tom π
February 3, 2017 at 6:44 am #273795urs
Hi
Im using GP premium current Version and WP 4.7.2.
My Header image is not resizing to Mobile view under http://www.philippinen-blog.ch
Any idea what i can do?
ThanksFebruary 3, 2017 at 8:30 am #273827Leo
StaffCustomer SupportHi there,
Unfortunately thatβs just the nature of background images β it has to do with the aspect ratio.
The ratio on a desktop is different than on mobile, but the image still has to fill the area, so certain part of it arenβt shown.
One solution is to create an image just for mobile, then apply it using some CSS:
@media (max-width: 768px) { .site-header { background-image: url( 'URL TO YOUR MOBILE BACKGROUND IMAGE' ); } }
Let me know if this helps.
February 3, 2017 at 11:33 am #273907Tom
Lead DeveloperLead DeveloperSarah – I’m not seeing just the bottom of your nose, but I am seeing the repeated image. This is happening because the area is so tall and your image isn’t tall enough to scroll down that much.
You can try setting the top/bottom padding to a percentage instead of pixels. You might also need to reduce the height a bit, or increase the height of your image.
urs – it’s best not to include a logo or text in a background image. You’ll want to separate the logo from the background, and upload it in Customize > Site Identity.
If either of you need more help it might be better to start a new topic so the original author of this one doesn’t get a bunch of emails π
February 3, 2017 at 12:03 pm #273927urs
thanks Tom
for me the case is closed. Quick and dirty – just added the header image to “site idendity – Logo”.
This makes the trick and the image is resposive as a charme now.
regardsFebruary 3, 2017 at 12:15 pm #273936Tom
Lead DeveloperLead DeveloperGreat π
February 6, 2017 at 5:03 am #274992Sarah
Thanks Tom, changing padding didn’t help, so I checked the image dimensions I used on a client site that worked great and applied the same aspect ratio to mine of 4:3 – it all seems to be working fine now on desktop and mobile phone but in Customiser it still displays only to my nose on tablet size, despite doing the custom class and css:
@media (max-width: 768px) {
.custom-mobile-bg {
background-image: url(‘https://sarahcairncross.com/wp-content/uploads/2017/02/sarah-cairncross-header-mobile.jpg’) !important;
height: 200px;
margin-left: auto;
margin-right: auto;
}
}February 6, 2017 at 7:08 am #275047Leo
StaffCustomer SupportHi Sarah,
Would you mind opening a new topic for your question so the original author of this post doesn’t get a bunch of e-mails?
Thank you!
February 6, 2017 at 10:40 am #275173Tom
Lead DeveloperLead DeveloperThe media query specific to tablets is:
@media (min-width: 769px) and (max-width: 1024px)
February 6, 2017 at 10:28 pm #275364Sarah
Hi Leo, I kept it in here as it’s all part of the same topic – I used code suggested early on in the thread. If people don’t like getting updates, they can simply log into the post and untick the box at the bottom labelled Notify me of follow-up replies via email π
Thanks Tom! will go and change things π
February 6, 2017 at 11:46 pm #275367Tom
Lead DeveloperLead DeveloperLet me know how it goes π
February 14, 2017 at 4:12 am #278552Sarah
Just made the changes and it works perfectly now! Thank you Tom! π
February 14, 2017 at 11:30 am #278747Tom
Lead DeveloperLead DeveloperYou’re welcome π
March 21, 2018 at 7:26 am #525340rex wickham
Hi Tom
I’ve used the suggested code, but it’s not working for me. In firefox developer console I can see the original large image is used and not the custom class – see screenshot:https://imagebin.ca/v/3veDG7Ht3uc9
This is what I added to the Section:
custom-mobile-bg
and this is what is added in tthe WordPress customiser. I include a bit of other code which I wonder if problematic:
@media all and (min-width: 480px) { .deskContent {display:block;} .phoneContent {display:none;} } @media all and (max-width: 479px) { .deskContent {display:none;} .phoneContent {display:block;} } @media (max-width: 768px) { .custom-mobile-bg { background-image: url('http://www.rnli-911challenge.co.uk/wp-content/uploads/2018/03/home-page-mobile.jpg'); } }
Not sure where I am going wrong, can you help?
Thankyou
-
AuthorPosts
- You must be logged in to reply to this topic.