将onclick新窗口转换为onclick花式框?

时间:2012-07-19 10:07:00

标签: javascript fancybox

将onclick新窗口转换为onclick花式框?

得到这个免费的代码显示Facebook照片和它的伟大,但它打开一个新的窗口,并没有真正做到正义,想转换它打开一个fancybox而不是任何帮助赞赏。"代码下面"

完整网址= http://www.footfalldigital.co.uk/fbalbum.html

先谢谢李"我有一天会给你买一品脱"

<script language="javascript" type="text/javascript">
    function popitup(url) {
        newwindow=window.open(url,'name','height=450,width=600,location=1,toolbar=1,status=1,resizable=1')
        if (window.focus) {newwindow.focus()}
        return false;
    }
</script>
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
<script type="text/javascript"> 
    <!-------ENTER YOUR FACEBOOK ALBUM IDS HERE------->
    var id1 = "444691594416";
    var id2 = "";
    var id3 = "";
    var id4 = "";
    var id5 = "";
    <!----------------------------------------------->
    function fbFetch1(){
        var url = "https://graph.facebook.com/" + id1 + "/photos&callback=?&limit=0";
        $.getJSON(url,function(json){
        var html = "";
        $.each(json.data,function(i,fb){
        var name = "";
        if (fb.name !== undefined){
        var name = fb.name;}
        html += "<a onclick=\"return popitup('" + fb.source + "')\"><img style='margin:5px;padding:0px;cursor:pointer;vertical-align:middle;' src=" + fb.picture + " title=\"" + name + "\"></a>"; });
        html += "";
        $('.facebookfeed1').animate({opacity:0}, 500, function(){
            $('.facebookfeed1').html(html);});
            $('.facebookfeed1').animate({opacity:1}, 500);}
        );
    };
    function fbFetch2(){

1 个答案:

答案 0 :(得分:0)

如果您已经拥有网页上的所有图片,为什么不看:http://lokeshdhakar.com/projects/lightbox/ 它会自动查看选择器中的图像并为您添加相册。

取自他们的网站:

How to Use:

Include lightbox.js in your header.

<script type="text/javascript" src="lightbox.js"></script>

Add rel="lightbox" attribute to any link tag to activate the lightbox. For example:

<a href="images/image-1.jpg" rel="lightbox" title="my caption">image #1</a>

Optional: Use the title attribute if you want to show a caption.

<强>更新

http://lokeshdhakar.com/projects/lightbox2/ - Updated version

Replace:
$('.facebookfeed5').animate({opacity:0}, 500, function(){
$('.facebookfeed5').html(html);});
$('.facebookfeed5').animate({opacity:1}, 500);});};
With: 
$('.facebookfeed5').animate({opacity:0}, 500, function(){
     $('.facebookfeed5').html(html);});
     $('.facebookfeed5').animate({opacity:1}, 500);})
     $('img').attr('rel','lightbox')
;};