Menu icon Foundation
Update plugin options and reInit

2X Reveal modals are defined on a page and after the page is overlaid with modal #1 the options of modal #2 need updating:

<!-- modal #1 div with markup from XHR request(s) -->
<div id="modalWM3_0" class="reveal large" data-reveal data-options="closeOnClick:false; closeOnEsc:false;">
</div>

<!-- modal #2 div with markup from (transient) XHR request(s) -->
<div id="modalWM3_1" class="reveal medium" data-reveal>
</div>

Changing the attributes of modal #2:

// recreate Reveal modal for transient use
$("#modalWM3_1").removeClass("medium").addClass("large").attr("data-options":"closeOnClick:false; multipleOpened:true;");

 and calling reInit:

Foundation.reInit($("#modalWM3_1"));

the options are not updated and modal #1 is closed when modal #2 is opened.

 

Using the sequence:

$("#modalWM3_1").foundation("destroy");
new Foundation.Reveal($("#modalWM3_1"), {"closeOnClick":false, "closeOnEsc":false, "multipleOpened":true});

'works' but (jQuery) delegated events (.on) of elements (.load()) into modal #2 with are cancelled when .foundation('destroy') is called.

Summation: how to update options of a plugin prior to reInit? 

F6 reInit options destroy

2X Reveal modals are defined on a page and after the page is overlaid with modal #1 the options of modal #2 need updating:

<!-- modal #1 div with markup from XHR request(s) -->
<div id="modalWM3_0" class="reveal large" data-reveal data-options="closeOnClick:false; closeOnEsc:false;">
</div>

<!-- modal #2 div with markup from (transient) XHR request(s) -->
<div id="modalWM3_1" class="reveal medium" data-reveal>
</div>

Changing the attributes of modal #2:

// recreate Reveal modal for transient use
$("#modalWM3_1").removeClass("medium").addClass("large").attr("data-options":"closeOnClick:false; multipleOpened:true;");

 and calling reInit:

Foundation.reInit($("#modalWM3_1"));

the options are not updated and modal #1 is closed when modal #2 is opened.

 

Using the sequence:

$("#modalWM3_1").foundation("destroy");
new Foundation.Reveal($("#modalWM3_1"), {"closeOnClick":false, "closeOnEsc":false, "multipleOpened":true});

'works' but (jQuery) delegated events (.on) of elements (.load()) into modal #2 with are cancelled when .foundation('destroy') is called.

Summation: how to update options of a plugin prior to reInit? 

Alex Laforge about 1 year ago

I Would appreciate an update on this, too... I need to open a reveal sometimes with escOnClose:true, other times with escOnClose:false...

Philip Chester about 1 year ago

Yaa it continues updating this year. Have you written new post? 

gmail