0

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

获得了用于显示 facebook 照片的免费代码,它很棒,但它会打开一个新窗口,但它并不能真正做到公正,希望将其转换为打开一个花式框,而不是任何帮助。“代码如下”

完整网址 = 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(){
4

1 回答 1

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')
;};
于 2012-07-19T10:09:45.123 回答