0

所以我有一系列图像,如下所示:

   <div id="gallery-top-picture"><img src= "images/IMG_1786.jpg" width="125" height="125" border="1"></div>
   <div id="gallery-top-picture"><img src= "images/IMG_2178.jpg" width="125" height="125" border="1"></div>
   <div id="gallery-top-picture"><img src= "images/IMG_2196.jpg" width="125" height="125" border="1"></div>
  </div>
   <div class="gallery-content">
   <div id= "gallery-bottom-picture"><img src="images/IMG_2214.jpg" width="125" height="125" border="1"></div>
   <div id="gallery-bottom-picture"><img src= "images/IMG_2273.jpg" width="125" height="125" border="1"></div>
   <div id="gallery-bottom-picture"><img src= "images/IMG_2274.jpg" width="125" height="125" border="1"></div>
   <div id="gallery-bottom-picture"><img src= "images/IMG_2277.jpg" width="125" height="125" border="1"></div>
   <div id="gallery-bottom-picture"><img src= "images/IMG_2280.jpg" width="125" height="125" border="1"></div>

我希望当我点击其中一个时,另一个虚拟窗口出现在当前窗口的顶部,只有我点击它的图像,有人可以告诉我如何在 javascript 上执行此操作吗?谢谢。

4

3 回答 3

0

尝试将此<a>链接标签添加到您的图像中:

<a href="javascript:void window.open('YOUR-IMAGE.jpg', 'width=WIDTH,height=HEIGHT,toolbar=0,menubar=0,location=0,status=0,scrollbars=0,resizable=0');">IMAGE HERE</a>

...例如:

<div id="gallery-top-picture">
    <a href="javascript:void window.open('images/IMG_1786.jpg', 'width=250,height=250,toolbar=0,menubar=0,location=0,status=0,scrollbars=0,resizable=0');">
        <img src= "images/IMG_1786.jpg" width="125" height="125" border="1"/>
    </a>
</div>
于 2013-06-05T15:25:16.350 回答
0

尝试这个

$("img").click(function(){
var src = $(this).attr("src");
window.open(src, "Image", "height=200,width=200");});
于 2013-06-05T15:28:08.053 回答
0

您也可以这样做,只需根据自己的喜好自定义 css。单击图像,然后单击背景使其恢复正常。

http://jsfiddle.net/sanpopo/9SqjL/

onclick="expand(this);"

您只需在图像标签上使用此功能

于 2013-06-05T18:40:42.390 回答