2011-12-22 28 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