close button appears once only

255 views Asked by At

I've got a small problem with the close button. When I call the popup, the close button appears normally. I then close the popup. But if I call the popup again, the close button doesn't appear anymore.

My code:

<script>
  ;(function($) {
     $(function() {
         $('#marc').on('click', function(e) {
            e.preventDefault();
            $('#about_popup').bPopup({
                content:'iframe',
                contentContainer:'#about_popup',
                modalClose: true,
                loadUrl:'about_marc.html'
            });
        });
    });
  })(jQuery);
</script>

(...)

<div id="about_section">
    <a id="marc"><img src="bla.jpg" /></a>
</div>
<div id="about_popup">
    <a class="b-close">x<a/>
</div>

What's the issue? Thanks. Ju.

1

There are 1 answers

2
Deepak David On

ok I guess the content loading does a innerHTML removing the content inside about_popup id

<div id="about_popup">
    <a class="b-close">x<a/>
    <div id="about_popupContent"></div>
</div>

Change the id to "about_popupContent"

 $('#about_popup').bPopup({
                content:'iframe',
                contentContainer:'#about_popupContent',
                modalClose: true,
                loadUrl:'about_marc.html'
            });