我希望在使用关闭按钮关闭我的花式框时以及当交易成功时关闭我的想象时具有不同的功能。
我使用了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"); }更多推荐
发布评论