Treehouse: Grow your CSS skills. Land your dream job.

text overlay

  • # January 28, 2012 at 7:51 pm

    I”m attempting to write a little javascript function which will display an overlay with some text when an image is clicked on. I’ve created an array variable which holds the different text descriptions. the index should correspond to the image e.g. image 0 will correspond to the 1st item in the text array and so forth. how do i find out which child of the parent node “photoWrap” has been clicked on? if I know which child it is, I can use that as the index to the overlayText array – or do you have a better way of associating the image with the text?
    The html is

    the javascript is

    # January 29, 2012 at 11:45 pm

    Rather than create arrays, I would prefer to insert the text of the attributes within the image itself:

    # February 3, 2012 at 8:24 am

    yes, using the alt attribute is an easier way, thanks.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.