将hideLoading方法放在Fancybox 2函数中的何处



我目前正在使用fancyBox 2。就像一个魅力,伟大的工具。只有一件事:我想禁用加载图标,但我不知道应该把它放在哪个回调中。这是我正在使用的代码:

$("a.iframe").each(function () {
  $(this).fancybox({
    'openEffect': 'elastic',
    'closeEffect': 'elastic',
    'margin': 0,
    'padding': 0,
    'topRatio': 0.1,
    'scrolling': 'no',
    'modal': true,
    'type': 'iframe',
    'afterLoad': function () {
      $.fancybox.hideLoading();
    },
    'afterShow': function () {
      var heightPane = $('.fancybox-iframe').contents().find('#content').height();
      $('.fancybox-iframe').contents().find('#pane2').css({
        'height': heightPane + 'px',
        'overflow': 'auto'
      })
    }
  })
});

正在放入$.fancybox.hideLoading();在afterLoad回调中没有任何作用。加载图标仍会出现。我甚至把methode放在了函数之前,仍然会出现图标。

有人知道该怎么办吗?

作为一种变通方法,尝试添加一个css内联声明(在加载了fancybox css文件之后):

#fancybox-loading {display: none !important;}

有一个选项imgPreload没有很好的文档记录,我认为它应该适用于此(替换加载图标或取消它)

最新更新