Home › Forums › Support › How to add overlay effect with custom text for single page featured images
- This topic has 11 replies, 4 voices, and was last updated 8 years, 5 months ago by
Tom.
-
AuthorPosts
-
September 12, 2017 at 2:51 am #383747
Ralfs
Looking for something similar to this – http://jsfiddle.net/51csqs0b/
I want to display custom text ex. “Please contact us for more images” on image as overlay when visitors hovers over image.
How can I do that with current theme?
September 12, 2017 at 8:05 am #383934Leo
StaffCustomer SupportLooks like its just simple HTML and CSS.
Their method should work as it is.
Let me know if you need more info.
September 12, 2017 at 8:22 am #383949Ralfs
Well, how can I implement the css then?
September 12, 2017 at 8:22 am #383952Ralfs
so it would be working for single posts featured images
September 12, 2017 at 8:34 am #383958Leo
StaffCustomer SupportAh you didn’t specify that before.
Try changing
.imageto.page-header-image-singlein the CSS and keep everything else the same.September 12, 2017 at 8:42 am #383965Ralfs
And what about “data-content=” tag? Where I should add it?
September 12, 2017 at 8:53 am #383970Ralfs
Hmm, still cannot get it working. Maybe you can suggest some other method of how to add simple overlay text on img hover?
September 12, 2017 at 9:20 am #383991Leo
StaffCustomer SupportHmm featured image could be tricky. See Tom’s explanation here: https://generatepress.com/forums/topic/caption-for-post-thumbnails/#post-86468
One thing you can try is to add the image at the top of your content as a static image then use the More tag: https://docs.generatepress.com/article/using-the-more-tag/
Then you can use the method above exactly how it is.
September 14, 2017 at 8:47 am #385381jennifer
I got this to work on my website, but I’m unsure how to implement it for mobile and tablet (touch screen).
Here is my website: overflowtucson.org
Any ideas? Thanks in advance!
September 14, 2017 at 10:16 am #385453Tom
Lead DeveloperLead DeveloperTouch events are pretty difficult when it comes to stuff like this.
You can try replacing:
.image:hover:after, .image:hover:before { opacity:1; }With:
.image:hover:after, .image:hover:before, .image:focus:after, .image:focus:before, .image:active:after, .image:active:before { opacity:1; }September 14, 2017 at 10:22 am #385457jennifer
Hmmm…or maybe a way for an indicator to come up on mobile and tablet to click and see the overlay text?
September 14, 2017 at 10:58 pm #385719Tom
Lead DeveloperLead DeveloperThat would require some sort of mobile tooltip script.
-
AuthorPosts
- You must be logged in to reply to this topic.