2014-04-08 2 views
0

Zurb Foundation 5를 실행하는 사이트가 있고 페이지에 복수 Reveal 모달을 배포합니다. 그들은 $('#DIVID').foundation('reveal', 'open');을 통해로드 될 때 제대로 작동하지만 다음과 같은 모달 내의 버튼을 통해 다른 모달을 트리거하면 예기치 않은 결과가 발생합니다.Zurb Foundation 5 - 다른 공개에서 트리거 된 JavaScript를 통해 공개

<script> 
$('#a_msg').on('click', '#v_update', function() { 
$('#a').foundation('reveal', 'close'); 
$('#v').foundation('reveal', 'open'); 
}); 
</script> 

첫 번째 모달 폐쇄 한 다음 두 번째 모달 화재,하지만 두 번째 모달을 닫지 않는 배경을 클릭하고 a class="close-reveal-modal" 버튼을 모달을 폐쇄 클릭을 닫으려고 만 할 때 배경이 회색으로 유지 .

오류는 두 번째 모달처럼 보이는 아래 foundation.js 소스 코드에서

Uncaught TypeError: Cannot read property 'bg_class' of undefined 

가 제대로 초기화되지 않습니다.

 S(document) 
     .on('click.fndtn.reveal', this.close_targets(), function (e) { 

      e.preventDefault(); 

      if (!self.locked) { 
      var settings = S('[' + self.attr_name() + '].open').data(self.attr_name(true) + '-init'), 
       bg_clicked = S(e.target)[0] === S('.' + settings.bg_class)[0]; 
Uncaught TypeError: Cannot read property 'bg_class' of undefined (repeated 2 times) 

      if (bg_clicked && !settings.close_on_background_click) { 
       return; 
      } 

      self.locked = true; 
      self.close.call(self, bg_clicked ? S('[' + self.attr_name() + '].open') : S(this).closest('[' + self.attr_name() + ']')); 
      } 
     }); 

     if(S('[' + self.attr_name() + ']', this.scope).length > 0) { 
     S(this.scope) 
      // .off('.reveal') 
      .on('open.fndtn.reveal', this.settings.open) 
      .on('opened.fndtn.reveal', this.settings.opened) 
      .on('opened.fndtn.reveal', this.open_video) 
      .on('close.fndtn.reveal', this.settings.close) 
      .on('closed.fndtn.reveal', this.settings.closed) 
      .on('closed.fndtn.reveal', this.close_video); 
     } else { 
     S(this.scope) 
      // .off('.reveal') 
      .on('open.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.open) 
      .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.opened) 
      .on('opened.fndtn.reveal', '[' + self.attr_name() + ']', this.open_video) 
      .on('close.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.close) 
      .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.settings.closed) 
      .on('closed.fndtn.reveal', '[' + self.attr_name() + ']', this.close_video); 
     } 

     return true; 
    }, 

공개 된 다른 공개 내 링크에서 공개가 제대로 작동하는 경험이있는 사람이 있습니까?

답변

1

다른 모달 간의 전환 중에 배경이 올바르게 토글되지 않습니다. ('. 공개 모달-BG를'). :

사용하여 마지막 모달 닫은 후 다음

$를 제거();

div를 제거하면 증상 (배경 오버레이)이 사라지고 bg_class가 정의되지 않은 js 오류가 중지됩니다.