简体   繁体   中英

Image Popup box with jquery

I have created a dropdown menu which holds different cities. Now I would like to be able to select a city and an image of the city should appear in a pop up box. I have a website that holds an image of each city and the urls only slightly differ from each other. Does anybody know how to write the function for this with jquery? Thanks in advance for every answer :)

you can create a hidden div that would pop up when you click on city.

something along these lines:

<div class="imgHolder">
    <img src="">
</div>

click on city would make popup show up:

$('.city').click(function(){

    $('.imgHolder').children("img").attr("src", var_image_path)
    $('.imgHolder').show();

});

something like this: http://jsfiddle.net/EMLH3/

i've left the styling part to you, but the basics are in the fiddle.

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