【问题标题】:How to hide the close button of a fancybox based on a click within the fancybox如何根据花式框内的点击隐藏花式框的关闭按钮
【发布时间】:2016-03-04 02:42:54
【问题描述】:

我们目前正在使用 Fancybox2。

在第一个网页上,我们点击一​​个链接打开一个花式框。然后在fancybox里面我们有额外的链接。我们希望能够点击幻想框内的链接,然后隐藏右上角的关闭按钮。

这是我们在第一个网页上的代码。

$(".popupwindow").fancybox({ padding: 0, margin : 50, openEffect : 'elastic', openSpeed : 200, closeEffect : 'elastic', closeSpeed : 150, scrolling : 'visible', width : '1040px', height : '90%', maxWidth : 1100, closeClick : false, iframe : { scrolling : 'auto', preload : true } }

这是启动fancybox的代码

<a href="somewhere" class="popupwindow">Open fancybox </a>

现在我们在幻想箱中。

点击链接我们有一个ID <a id="myTest">Something</a>

然后我们使用这个来跟踪点击...

$("#myTest").click(function(){

//At this point I'd like to hide the fancybox close button on top right.

}

我们知道如果我们将 parent.$.fancybox.close() 放在上面的函数中,它会关闭fancybox,但是,我们如何隐藏关闭按钮呢?不知道语法是什么。

我们在网站上看到了以下文档,并尝试了它的多种变体,但似乎无法让它发挥作用。

 $(".fancybox").fancybox({
   helpers: {
     closeBtn: false
   }
 });

【问题讨论】:

  • 您的关闭按钮是否有任何名称或 ID 或类别?您也可以发布 HTML,以及如何检测链接点击事件
  • 否,关闭按钮没有名称或类。我在原始帖子中发布了一些额外的 HTML 和 Jquery 来展示我们是如何做到的,包括如何检测点击事件。谢谢!

标签: jquery fancybox-2


【解决方案1】:
$(.fancybox-close).hide(); //hides it
...
$(.fancybox-close).show(); //shows it

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    • 2011-01-18
    • 1970-01-01
    相关资源
    最近更新 更多