最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do I correctly use Fancybox's onClose property? - Stack Overflow

programmeradmin1浏览0评论

I'm trying to update the shopping cart of my site upon closing a Fancybox instance. I'm using Fancybox 1.3.4. Assuming my function is valid, shouldn't the following work?

<script type="text/javascript">

$(function () { 
    $("a.ProductRollover").fancybox({     
       'padding':0,
       'width': 785,
       'height': 554,
       'autoScale': false,
       'type': 'iframe',
       'onClosed': function() {
           $('#cart_total').html(json['total']);
        }
    });
});

</script>

Thank you.

I'm trying to update the shopping cart of my site upon closing a Fancybox instance. I'm using Fancybox 1.3.4. Assuming my function is valid, shouldn't the following work?

<script type="text/javascript">

$(function () { 
    $("a.ProductRollover").fancybox({     
       'padding':0,
       'width': 785,
       'height': 554,
       'autoScale': false,
       'type': 'iframe',
       'onClosed': function() {
           $('#cart_total').html(json['total']);
        }
    });
});

</script>

Thank you.

Share Improve this question asked Mar 14, 2012 at 0:09 jmealyjmealy 5821 gold badge5 silver badges15 bronze badges 2
  • I don't spot anything wrong. Have you tried doing a simple alert() inside your onClosed function? – tybro0103 Commented Mar 14, 2012 at 0:22
  • try this stackoverflow./a/11920579/266644 – mola10 Commented Aug 12, 2012 at 15:47
Add a ment  | 

1 Answer 1

Reset to default 3

Instead of using onClosed use beforeClose or afterClose. Find the API documentation under the Callbacks tab here http://fancyapps./fancybox/#docs.

Moreover, answer by Mottie over here Load new content in Fancybox on Fancybox onClosed event might be helpful.

发布评论

评论列表(0)

  1. 暂无评论