bpopup onClose回调事件无效

时间:2014-08-14 10:50:36

标签: javascript jquery bpopup

回弹事件没有在弹出关闭时通过模态,关闭按钮和esc触发,我已经尝试将其添加到文档准备就绪,也点击触发器,它们已经工作了

 $('.flipvideowrap').bind('click', function(e) {
                  e.preventDefault();
                   $('#element_to_pop_up').bPopup({
                    appendTo: 'form'
                    , zIndex: 1001
                    , easing: 'easeOutBack'              
                    , speed: 450
                    , transition: 'fadeIn'
                    , appendTo:'body'                
                    , closeClass: 'b-close'
                    , modalClose: true
                    , modalColor: '#fff'
                    , model: false   
                    ,escClose:true         
                    , position: ['auto', 42] //x, y
                  });
                   $("video").trigger("play");

                    $('#element_to_pop_up').bPopup({ onClose: function(){
                      console.log('closed');
                        var myPlayer = videojs('look_video');
                        myPlayer.pause();
                   }});

                });

1 个答案:

答案 0 :(得分:2)

看起来您的代码实际上会触发弹出两次。试试这个:

$('.flipvideowrap').bind('click', function(e) {
              e.preventDefault();
               $('#element_to_pop_up').bPopup({
                appendTo: 'form'
                , zIndex: 1001
                , easing: 'easeOutBack'              
                , speed: 450
                , transition: 'fadeIn'
                , appendTo:'body'                
                , closeClass: 'b-close'
                , modalClose: true
                , modalColor: '#fff'
                , model: false   
                ,escClose:true         
                , position: ['auto', 42] //x, y
                , onClose: function(){
                  console.log('closed');
                    var myPlayer = videojs('look_video');
                    myPlayer.pause();
               }
              });
               $("video").trigger("play");
            });