2011-12-22 27 views
0

我是新人,我的大脑在燃烧在新标签页中打开缩略图

我的问题是这样访问我有一个网站lemonx.biz。

正如你所看到的,我在那里制作了4个框架,展示zara hermes和puma的小鞋子。

当在小缩略图这是在文件夹images/zara/thumbnals/1.png表示ZARA彪马和Hermes的用户点击鞋新窗选项卡,打开从images/zara/1.png图像中一个div使用HTML JavaScript或jquery的显示缩略图的放大版本。

回答

2

用指向图像放大版和target="_blank"href将锚定标记中的图像包裹起来。

编辑:根据您的更新说明。

不直接链接到图像,链接到next.html#name_of_image.jpg。然后,在加载next.html时,执行javascript以使用适当的图像填充目标div。

如:

<!--Include a placeholder image in your HTML in the target div...--> 
<div id="target_div"> 
    <img id="target_img" style="display: none;" src=""/> 
</div> 

<!--...And populate it on page load with Javascript.--> 
<script type="text/javascript"> 
    window.onload = function() 
    { 
     if (location.hash) //Only do this if there's an actual hash value. 
     { 
      var imgPath = 'path/to/images/directory/'; //Build the path to the images directory. 
      var imgName = location.hash.substring(1); //Get the name of the image from the hash and remove the #. 
      document.getElementById('target_img').src = imgPath+imgName; //Update the src of the placeholder image with the path and name of the real one. 
      document.getElementById('target_img').style.display = 'inline'; //Now that it has a valid source, reveal it to the viewer. 
     } 
    } 
</script> 
+0

我这样做,它的作品,但我在此页面中我有一个div我想在next.html在特定的div – sajid 2011-12-22 09:44:15

+0

打开点击缩略图页面next.html @ sajid啊,好的。没有汗水。检查我上面编辑的答案。 – Aaron 2011-12-22 20:37:20

+0

亲爱的阿伦你的代码会做的是,我有100的图片和所有的图片,我必须附上一个HTML,并在每一个HTML我必须嵌入JavaScript代码这不是我需要动态的一些东西的解决方案 – sajid 2011-12-23 04:35:29