- This topic has 41 replies, 2 voices, and was last updated 1 year, 3 months ago by
David.
-
AuthorPosts
-
February 18, 2016 at 2:48 am #173579
Guido
Hello,
I would like to change the header image, when the screen is smaller than 890px, but I have no idea how I can do that.
With a screen size of about 890px this to display
http://rs-massivholzkueche.de/wp-content/uploads/2016/02/custom2.jpg
With a screen size of less than 890px this to display
http://rs-massivholzkueche.de/wp-content/uploads/2016/02/custom.jpg
Unfortunately I can not find the code snippet for the style.css
media only screen and (max-width: 890px) {
????I use GP Premium and look forward to useful tips.
Thank you
GuidoFebruary 18, 2016 at 9:59 am #173637Tom
Lead DeveloperLead DeveloperHi Guido,
In GP Hooks, you would add your two images like this:
<div class="desktop-image"> <img src="URL TO DESKTOP IMAGE" alt="" /> </div> <div class="mobile-image"> <img src="URL TO MOBILE IMAGE" alt="" /> </div>
Then you would add this CSS:
.mobile-image { display: none; } @media (max-width: 890px) { .desktop-image { display: none; } .mobile-image { display: block; } }
February 18, 2016 at 1:01 pm #173703Guido
Hi Tom,
great, it works. Thank you for your support.
Just one last question
How can I center the mobile-image?Thank you for an answer.
GuidoFebruary 18, 2016 at 11:33 pm #173764Tom
Lead DeveloperLead DeveloperThis CSS should do it:
.mobile-image { text-align: center; }
February 19, 2016 at 12:05 am #173775Guido
Hi Tom,
I thank you for your support.
GuidoFebruary 19, 2016 at 10:15 am #173871Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
July 13, 2017 at 3:59 am #348700Tully
Hi Tom,
Wanting to do the same thing, to make the header image larger in mobile. Never used hooks. What section of GP Hooks should I put the code in?
Thanks, Tully
July 13, 2017 at 8:04 am #348823Leo
StaffCustomer SupportTry this Before Header Content hook: http://demo.generatepress.com/hook-locations/
July 17, 2017 at 1:13 am #350486Tully
Hi Leo,
Thanks for that.
I added the code into hooks before header content, and added the css, but all I got was two header images one above the other?
Regards
TullyJuly 17, 2017 at 8:36 am #350657Leo
StaffCustomer SupportHmm the CSS should’ve hidden one or the other.
Can you link me to the site?
July 17, 2017 at 5:07 pm #350897Tully
Site is https://workingsheepdogtraining.com
However I have disabled the gp hook and commented out the css at the moment due to it not working.
July 17, 2017 at 5:11 pm #350899Leo
StaffCustomer SupportCan you test with this CSS and see if it works?
.mobile-image { display: none; } @media (max-width: 768px) { .desktop-image { display: none; } .mobile-image { display: block; } }
If not I would also need to see the code in place to tell why it’s not working. Thanks!
July 17, 2017 at 6:50 pm #350922Tully
Hi Leo,
Have tried that but still same result. The code is active now with two headers showing if you could have a look fairly soon that would be great as obviously I don’t want the webpage live looking as is at the moment! Thanks Leo
July 17, 2017 at 8:14 pm #350954Leo
StaffCustomer SupportTry removing your logo in Customizer > Site Identity
July 18, 2017 at 1:24 am #351036Tully
Thanks Leo that has fixed the two header issue. However now there is a white line beneath the header image, between it and the menu. And the image isn’t changing on mobile?
-
AuthorPosts
- You must be logged in to reply to this topic.