Monday, February 11, 2013

Closing Modal Page on button click

If you are using SkillBuilders Modal Page Plugin (version 2.0.0 that uses ColorBox) and want to close it dynamically on button click there are easy way of doing this using page button template (instead of creating DA on each modal page ).

Create a copy of your button template and add to it a CSS class, for example closeModal:



After that add JS that closes modal page (to the page template or JS file):



The final step is to change your button template to newly created one. Also check that your button Action property is defined as "Defined by Dynamic Action".

I've also created plugin for this, so if somebody needs it, send me an email. But I think that using above described aproach is more convenient.