javascript - Fancybox can't reopen popup: Uncaught TypeError: Cannot read property 'width' of null -
using latest fancybox , jquery 2.2.3 i'm trying open "child" popup pressing button in "parent" popup, , reopen parent popup after closing child popup.
by themselves, popups open , close fine. when try go reopen parent, shows second, disappears message in console: "jquery.fancybox.pack.js:40 uncaught typeerror: cannot read property 'width' of null". happens point this: this.overlay.width(a).height("100%");
when try reopen parent manually, intstead see popup "the requested content cannot loaded. please try again later."
i've tried 2 approaches, both fail
(.fancybox-to-form button inside parent, pressing open child):
1)
$(".fancybox-to-form").on("click", function(){     var parentpopup = $(this).closest(".wall-popup");      $.fancybox.open( $("#popup-form"), {                 afterclose: function(){             $.fancybox.open( {href: '#wall-popup--1'} );         }     } ); });   2)
$(".fancybox-to-form").fancybox({     afterclose: function(){         var parentpopup = $(this.element).closest(".wall-popup");         $.fancybox.open( parentpopup );     } });   help appreciated.
you can try settimeout 2nd fancybox. (~100ms) maybe 1st fancybox not closed @ time 2nd displayed.
Comments
Post a Comment