简体   繁体   中英

Need suggestions on Javascript for image rollover with text change in <div>

I'm trying to write a javascript that will do two things. First when you roll over a thumbnail of a picture it loads the larger view in a div container. That part works. But the other thing is that there is a description that goes with each picture that needs to load in a different div container. So far I get the one description loaded and then it gets stuck and the next won't load. I think I just need a little push with the type of objects and methods and such to use. I'm obviously not an experienced javascripter.

Thanks in advance for any suggestions you can offer

Sue B.

Perfect case for jQuery... Try this... http://jsfiddle.net/jchandra/dY8Dp/

Basically I'm adding a data- attribute to store the real pic URL and reusing the title tag for the description.

If you insist on pure JavaScript, it's a bit ugly, but ... here it is... http://jsfiddle.net/jchandra/aDe3u/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM