2010-02-10 77 views
7

我试图让一个jQuery覆盖加载一个外部页面。如何在jQuery覆盖弹出窗口中加载外部页面?

我想我有jQuery的两个版本互相冲突,因为我用这一个拖放和正常工作:

src="js/jquery-1.3.2.min.js 

js/jquery-ui-1.7.2.custom.min.js 

现在,当我补充一点:

http://cdn.jquerytools.org/1.1.2/full/jquery.tools.min.js 

对于覆盖它似乎不工作。有没有人有与外部页面简单的覆盖?

+0

Avrumi,生病尝试回答.....(EB) – adardesign 2010-02-10 22:41:21

回答

5

HTML

<a id="selector" href="#">My event trigger</a> 
<!-- put the the overlay below before closing </body> the end of the page --> 
<div class="overlayOuter"> 
    <div class="overlayInner"> 
     <!-- external content to be loaded here --> 
    </div> 
    </div> 

CSS

.overlayOuter{ 
    background:#000; 
    opacity:0.7; 
    display:none; 
    height:100%; 
    left:0; 
    position:absolute; 
    top:0; 
    width:100%; 
    z-index:100001; 
} 


.overlayInner{ 

    position:absolute; 
    top:40%;/*or whatever*/ 
    left:40% /*or whatever*/ 
    width:500px; 
    z-index:100001; 
} 

JS

$("a#selector").live("click", function(){ 
    $(".overlayInner").load("externalPage.html", 
     // the following is the callback 
     function(){$(".overlayOuter").fadeIn(300); }) 
}); 
9

但是,为什么你不使用的fancybox以上B这里埃特颜色框是链接

http://colorpowered.com/colorbox/

彩盒是光有凉爽的效果只是给它一个尝试,你可以主题,因为它是基于CSS。

感谢