English 中文(简体)
在Facebook Canvas iFrame
原标题:Fancybox Positioning Inside Facebook Canvas iFrame

因此,我有一把镜子,用面板“javascrip sdk”电话打到“Settable”上;和FB.Canvas.setAutoGrow();。 这些都是完美的工作,因为iframe根据其内容被设定为某种高温。

The problem is that when I make a call to Fancybox, it positions itself based on this height. I know that s exactly what its supposed to do as the fancybox jQuery returns the viewport by:

(最新版本jquery.fancy Box-1.3.4.js第673条):

_get_viewport = function() {
return [
    $(window).width() - (currentOpts.margin * 2),
    $(window).height() - (currentOpts.margin * 2),
    $(document).scrollTop() + currentOpts.margin
];
},

But the problem is the iframe will, for a lot of viewers, be longer than their browser window. So the Fancybox centers itself in the iframe and ends up only partly visible to the majority of viewers. (i.e. iframe height is 1058px and users browser is say only 650px).

是否有办法仅仅计算物理浏览器高高的轮胎箱子? 或者,我是否需要在Facebooksvas的记忆中改变某些环境,使之发挥作用?

I like how the only scrollbar is the one on Facebook (the parent, if you will).

All suggestions GREATLY appreciated!

最佳回答

参考框2试图:

发现:

_start: function(index) {

and replace 注

_start: function(index) {
    if ((window.parent != window) && FB && FB.Canvas) {
        FB.Canvas.getPageInfo(
            function(info) {
                window.canvasInfo = info;
                F._start_orig(index);
            }
        );
    } else   {
        F._start_orig(index);
    }
},

_start_orig: function (index) {

然后,getViewport 改为return rez;:

if (window.canvasInfo) {
    rez.h = window.canvasInfo.clientHeight;
    rez.x = window.canvasInfo.scrollLeft;
    rez.y = window.canvasInfo.scrollTop - window.canvasInfo.offsetTop;
}

return rez;

以及最后在<><>的功能取代:

} else if (!current.locked) {

} else if (!current.locked || window.canvasInfo) {
问题回答

由于面纱 a提供了一页信息,因此我们可以使用。

发现

    _start = function() {

替换

    _start = function() {
        if ((window.parent != window) && FB && FB.Canvas) {
            FB.Canvas.getPageInfo(
                function(info) {
                    window.canvasInfo = info;
                    _start_orig();
                }
            );
        } else   {
            _start_orig();
        }
    },

    _start_orig = function() {

and also modify _get_viewport function

    _get_viewport = function() {
        if (window.canvasInfo) {
            console.log(window.canvasInfo);
            return [
                $(window).width() - (currentOpts.margin * 2),
                window.canvasInfo.clientHeight - (currentOpts.margin * 2),
                $(document).scrollLeft() + currentOpts.margin,
                window.canvasInfo.scrollTop - window.canvasInfo.offsetTop + currentOpts.margin
            ];
        } else {
            return [
                $(window).width() - (currentOpts.margin * 2),
                $(window).height() - (currentOpts.margin * 2),
                $(document).scrollLeft() + currentOpts.margin,
                $(document).scrollTop() + currentOpts.margin
            ];
        }
    },

我也存在同样的问题,即使用电网:真实,现在做的是罚款。

Had the same problem. Thankfully fancybox is accessable through CSS. My solution was to overwrite fancybox s positioning in my CSS file:

#fancybox-wrap {
    top:    20px !important;
}

该法典将ancy箱永远从机上排出20px。 如果你喜欢的话,使用不同的面积。 ! 进口商将这一位置固定下来,即使ancy箱在运行时能动地确定立场。

这里用一种方式,是把租赁箱放在另一个要素的位置上,在我的案件中,在用户上传图像后显示观点联系的整批电箱。

a. 具有一套类似身份的风格:

<style id="style-block">
body { background-color: #e7ebf2; overflow: hidden; }
</style>

然后,与开放租赁箱连接起来,需要一个带有图像名称、宽度和高度的功能,以确定内容和规模。 重要部分是立场。 通过使电梯的位置完整,产生新的班级申报(位置),将其贴在“边放”的风格,将轮胎箱装上(在班子中进口将压倒从轮胎箱中的位置),然后在车箱选择中增加使用包装安全参数的新班子,在我想要时就把它放在了位置。

function viewImage(image, width, height) {
    var complete_pos = $( #image_queue_complete ).position();
    var css_code =  .fancy-position { top:   + complete_pos.top.toString() +  px !important; } ;
    $( #style-block ).append(css_code);
    var img_src =  <img src="images/  + image +  " width="  + width.toString() +  " height="  + height.toString() +  " /> ;

    $.fancybox({
        content: img_src,
        type:  inline ,
        autoCenter: false,
        wrapCSS:  fancy-position 
    });
}




相关问题
Facebook Connect login dialog not working

I am using Facebook Connect for iPhone and following the official instructions. I use the following code to display the login dialog: FBLoginDialog* dialog = [[[FBLoginDialog alloc] initWithSession:...

Facebook App Profile Tab is Empty ... No Content Displayed?

I can view my application via the http://apps.facebook.com/myapplication/ link and the content shows up correctly. I also added the application as a tab to a facebook page. However, when viewing the ...

Facebook Platform error: "Object cannot be liked"

I m working on a Facebook Application that generates wall posts. In testing these posts, I ve discovered that the Facebook Platform action of "liking" a post is failing. The specific error message ...

how to call showPermissionsDialog() in php (facebook api)?

I was reading over the documentation yet I could not figure out how to call Facebook.showPermissionsDialog() in php include_once ./facebook-platform/php/facebook.php ; $facebook = new Facebook(my ...

Facebook connect

If I plug in the facebook connect into my website, How can I prevent double signups? Lets say I have a user that s already signed up to my site but he clicked the connect with facebook, is there a ...

热门标签