English 中文(简体)
在 Sshow 函数之前使用 iframes 的花边框工作吗?
原标题:fancy box work with iframes in beforeShow function?

我正试图根据在装有花哨框的 iframe 内存储的标签中存储的信息, 动态地设定我的 Fancybox 对象的某些值。 问题是, 我唯一能将 CORRECT 值从内容( 几乎每个回调组合都尝试过) 上的时间, 是在 show 后的方法上 。 这导致宽度和高度在显示后被重置的突变 。

$( .fancybox ).fancybox({
            openEffect :  elastic ,
            closeEffect :  elastic ,
            autoSize:true,
            afterShow : function() {
                    var fancy = this;
                    var h = $( .fancybox-iframe ).contents().find( html ).height();
                    var w = $( .fancybox-iframe ).contents().find( html ).width();
                    fancy.width = w;
                    fancy.height = (h+50);
            }
        });

即使在Sshow之前(这就是我要追求的目标),除了事后展示方法之外,没有任何东西能给我正确的结果。在显示花瓶之前,是否有任何回响/口交组合可以实现这一点?谢谢!

最佳回答

您也可以在显示 < / code> 回调选项前使用 < code >, 但可能需要取消所有过渡( 设置 < code> extSpeed 和 < code> prevSpeed 到 < code> 0 )。

过渡速度似乎正在利用 afterShow 回调来创建跳跃效果,或者避免在Sshow 回调之前使用 获得正确的值。

您可能还需要更新到 fallbox 版本 v2. 0.6 。

此外,您还可以在不使用外部变量的情况下简化脚本,例如:

$(document).ready(function() {
 $("a.fancybox").fancybox({
  openEffect :  elastic ,
  closeEffect :  elastic ,
  fitToView: false,
  nextSpeed: 0, //important
  prevSpeed: 0, //important
  beforeShow: function(){
  // added 50px to avoid scrollbars inside fancybox
   this.width = ($( .fancybox-iframe ).contents().find( html ).width())+50;
   this.height = ($( .fancybox-iframe ).contents().find( html ).height())+50;
  }
 }); // fancybox
}); // ready

问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...