2011-12-22 5 views
0

私は新しいと私の脳は燃えている新しいタブでサムネイルを開く

私の問題はこれは私のウェブサイトlemonx.biz訪問です。

私がそこに作った4つのフレームには、小さな靴のザラ・ヘルメスとプーマがあります。

ユーザがフォルダimages/zara/thumbnals/1.pngにzara pumaとhermesの靴を表示している小さなサムネイルをクリックすると、新しいウィンドウタブが開き、images/zara/1.pngの画像がhtml javascriptまたはjqueryを使用して表示されます。

答えて

2

アンカータグに画像をラップし、画像の大きい方のバージョンを指すhreftarget="_blank"を指定します。

EDIT:更新された手順に従って。

画像に直接リンクする代わりに、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 – sajid

+0

にnext.htmlでクリックしたサムネイルを開きたいのdivを持っている私はそれが動作することを行っているが、私はこのページのページnext.htmlを持っています@ sahid Ahh、ok。汗かいていない。上記の私の編集された答えをチェックしてください。 – Aaron

+0

親愛なるアロン私は写真の100sを持っていると写真のすべてと私はhtmlを添付する必要があり、そのすべてのHTMLは私はjavascriptコードを埋め込む必要がありますこれは私がいくつかのものを動的に必要なソリューションではない – sajid

関連する問題