fancybox不同的关闭功能(fancybox different close functions)

编程入门 行业动态 更新时间:2024-10-24 01:48:06
fancybox不同的关闭功能(fancybox different close functions)

我希望在使用关闭按钮关闭我的花式框时以及当交易成功时关闭我的想象时具有不同的功能。

我使用了parent.$.fancybox.close(); 在交易成功时关闭花式框并且我希望它显示警告消息。 当使用关闭按钮关闭幻想时,我不希望提示警报消息。 这有可能发生吗?

这是我的父屏幕代码:

$(document).ready(function() { $(".popup").fancybox({ 'scrolling' : 'no', 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'closeClick' : false, 'autoDimensions' : true, 'width' : 1000, 'centerOnScroll' : true, 'onComplete' : function() { $('#fancybox-frame').load(function() { $('#fancybox-content').height($(this).contents().find('body').height()); }); }, 'onClosed' : function() {alert("Successful!"); } }); });

但它仍然显示警报消息是否使用关闭按钮或成功交易关闭。

i would like to have different function when my fancy box is closed using the close button and when my fancy is closed when the transaction is successful.

i used parent.$.fancybox.close(); to close the fancy box when the transaction is successful and i want it to display an alert message. while when the fancy is closed using the closed button i don't want the alert message to prompt. is there a way this could happen?

this is my code for the parent screen:

$(document).ready(function() { $(".popup").fancybox({ 'scrolling' : 'no', 'autoScale' : true, 'transitionIn' : 'none', 'transitionOut' : 'none', 'type' : 'iframe', 'closeClick' : false, 'autoDimensions' : true, 'width' : 1000, 'centerOnScroll' : true, 'onComplete' : function() { $('#fancybox-frame').load(function() { $('#fancybox-content').height($(this).contents().find('body').height()); }); }, 'onClosed' : function() {alert("Successful!"); } }); });

but it still shows the alert message whether it is closed using the close button or successful transaction.

最满意答案

从代码中删除此行。

'onClosed' : function() {alert("Successful!"); }

并在显式调用close函数时显示警报。 也许你可以创建这样的函数并调用parent.CloseFancyBox()而不是调用parent。$。fancybox.close()

function CloseFancyBox() { $.fancybox.close(); alert("Successful"); }

Remove this line from your code.

'onClosed' : function() {alert("Successful!"); }

and show alert when you call close function explicitly. May be you can create a function like this and call parent.CloseFancyBox() instead of calling parent.$.fancybox.close()

function CloseFancyBox() { $.fancybox.close(); alert("Successful"); }

更多推荐

本文发布于:2023-07-30 22:11:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1340362.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:功能   fancybox   functions   close

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!