2014-04-28 52 views
0

我想鏈接另一個HTML(nytimes.html)在這個CSS彈出框頂部的同一頁上。我怎麼做?鏈接在同一頁上的另一個html(javascript)

$('.portfolio-thumbnail').click(function(e) { 
console.log(this.id); //this is how we know what to load into the frame 
$('#popup-frame').fadeIn(); 

switch(this.id) { 
case "nytimes": 
    //do something for nytimes 
    $('#popup-frame').css('background', "rgba(0, 255,0, .5)"); 


    break; 
case "eloquence": 
    $('#popup-frame').css('background', "rgba(255, 82, 145, .5)"); 
    break; 
default: 
    break; 
} 
}); 
+0

是否要在iframe中打開鏈接?你可能想要:window.open(mylink,'popup-frame') – Aminadav

+0

'$('#popup-frame').load('nytimes.html')'會做到這一點。 – A1rPun

回答

1

我個人建議你嵌入您的CSS-彈出內的iFrame與你想顯示即裏面的網站。

case "nytimes": 
    //do something for nytimes 
    $('#popup-frame').css('background', "rgba(0, 255,0, .5)"); 

    $('#popup-frame').html('<iframe src="nytimes.html" name="popupFrame" scrolling="auto" frameborder="no" align="center" height = "100%" width = "100%"> </iframe>') 
    break; 

然後,您可以風格的IFRAME看你想怎麼使用,包括在iframe的CSS屬性zoom使內容看起來更小,如果你想放慢一個頁面的「預覽」。

+1

yay謝謝!有用 :) – user3555167

相關問題