Showing posts with label SkillBuilders. Show all posts
Showing posts with label SkillBuilders. Show all posts

Wednesday, May 8, 2013

Handling iframe call inside JS

There's an easy way to figure if your page is called inside iframe (e.g. using SkillBuilders Modal Page Plugin).
You can use simple JS snippet and put it inside Function and Global Variable Declaration of page properties:


After that you can use iFrameCall JS variable inside your page JS code, for example in dynamic actions for hiding some page elements (e.g. footer and header elements).

So, create dynamic action that fires on event Page Load and use your JS variable for condition:


The code of Execute JavaScript Code for hiding footer and header can look like this (if you have header and footer HTML tags in your template):

$('header').css('display', 'none');
$('footer').css('display', 'none');

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 is an easy way of doing this using the 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 the newly created one. Also, check that your button Action property is defined as "Defined by Dynamic Action".

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