Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Display Text in a Div on Mouseover

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #42985
    SirGabriel
    Member

    Jambo!

    I’m trying to create a grid of images; When you mouse over an image, text displays in a stationary Div.

    Anybody know how to do this?

    Here’s an example done in Flash: http://jasmine-star.com/#/life-in-the-in-between/

    #126127
    Paulie_D
    Member

    Sounds like a job for java script. Or rather jQuery

    #126129
    wolfcry911
    Participant
    #126130
    Paulie_D
    Member

    I haven’t reviewed the linked article as it doesn’t render well on my phone but from a cursory reading of the OP it sounds like the div will be populated with information on the hovered image BUT the div will have no relationship to the image.

    Hence, JS.

    #126131
    Andy Howells
    Participant

    Can possibly do it without JS. Will create a codepen.

    #126132
    Andy Howells
    Participant

    Yup it’s possible, though the text wouldn’t be easily editable if this is to run via a CMS, you’d have to change the text in the CSS stylesheet instead.

    http://codepen.io/andyunleashed/pen/yGdDi

    #126134
    Paulie_D
    Member

    If you have an image with an ‘alt’ or ‘title’ attribute it shouldn’t be had to populate that attribute text into text in a div….should it?

    Of course, my jQ skills are minimal but I’m sure I’ve seen it done.

    #126137
    Paulie_D
    Member

    Ugh….hacky indeed. :)

    As I said…JS is the way. Each image will have it’s own set attributes…it’s just a matter of grabbing them and sticking them/it in as text into another place.

    #126138
    Kitty Giraudel
    Participant
    #126139
    Andy Howells
    Participant

    Using JQ – http://codepen.io/andyunleashed/pen/etczA
    Actually @hugogiraudel’s is much better.

    #126144
    Paulie_D
    Member

    @HugoGiraudel I like that…copied for future reference.

    #126164
    wolfcry911
    Participant
    #126166
    Paulie_D
    Member

    @wolfcry911.

    I love solutions that don’t rely on JS/JQ but in practical terms your solution does mean having to update the text for each image if it were replaced.

    Applying an ‘alt’ tag is something that should be done to the vast majority of images by default (that aren’t styling) so the JS solution would seem to be optimal.

    Is your way more work or less?…I’m not sure TBH.

    #126171
    wolfcry911
    Participant

    To be fair the OP doesn’t give much detail except for the example link. There’s no information on how the image and text are related. If the text did not describe the image, I personally would not put it in the alt attribute. I’m not discrediting the JS methods (I have a similar pen), rather I’m giving the OP another option using html/css that mimics his flash example.

    For the record, if an image were replaced you’d be changing the alt text anyway…

    edit// anyone else finding lorempixel wonky today?

    #126177
    SirGabriel
    Member

    **Wow**. You guys are awesome! Looks like I now have a number of working solutions to choose from…

    I’ll be trying this out tonight after work.

    _THANK YOU_

Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘CSS’ is closed to new topics and replies.