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

javascript - Fancybox onClose not working - Stack Overflow

programmeradmin3浏览0评论

I am trying to redirect to the URL that is on my "onclose" attribute of the .fancybox ... it just does work. Any ideas? Code is below. Note: the modal appears fine, but when the user presses the "x" at the top... the screen is just blank.

<script type="text/javascript">
 showModal();


          function showModal() {


            var url = document.URL;
            var popUp = '//local.meau/Support-Center/Service-Notifications/Search-Tips.aspx';
            var site = popUp;


            $(document).ready(function () {
                $.fancybox({
                    'width': 500,
                    'height': '55%',
                    'autoScale': false,
                    'transitionIn': 'none',
                    'transitionOut': 'none',
                    'type': 'iframe',
                    'href': site,
                    'showCloseButton': true,
                    'onClose' : function(){location.href = ".aspx";}

                });

            });



        }


    </script>  

I am trying to redirect to the URL that is on my "onclose" attribute of the .fancybox ... it just does work. Any ideas? Code is below. Note: the modal appears fine, but when the user presses the "x" at the top... the screen is just blank.

<script type="text/javascript">
 showModal();


          function showModal() {


            var url = document.URL;
            var popUp = '//local.meau./Support-Center/Service-Notifications/Search-Tips.aspx';
            var site = popUp;


            $(document).ready(function () {
                $.fancybox({
                    'width': 500,
                    'height': '55%',
                    'autoScale': false,
                    'transitionIn': 'none',
                    'transitionOut': 'none',
                    'type': 'iframe',
                    'href': site,
                    'showCloseButton': true,
                    'onClose' : function(){location.href = "http://local.meau./Support-Center.aspx";}

                });

            });



        }


    </script>  
Share Improve this question asked Jul 16, 2013 at 21:12 Paul T. RykielPaul T. Rykiel 1,2276 gold badges27 silver badges52 bronze badges 1
  • maybe because the right name of the callback is onClosed (fancybox v1.3.4) – JFK Commented Jul 16, 2013 at 23:49
Add a ment  | 

1 Answer 1

Reset to default 5

updated your code to read

window.location = "http://local.meau./Support-Center.aspx"

Double check your onClose callback as well

  • v1.2 - http://fancybox/api/126 - callbackOnClose
  • v1.3 - http://fancybox/api - onClosed
  • v2.0 - http://fancyapps./fancybox/#docs - beforeClose or afterClose
发布评论

评论列表(0)

  1. 暂无评论