Page 1 of 2

Popup window

Posted: Fri Jun 22, 2012 11:58 am
by oldnema
Hello developers,
Sometimes I need to publish the entry page very, very important short message.
I would be very liked a similar solution as shown here http://famnissen.dk/cmsimple_addon/?Welcome
It is feasible and does anyone have any idea?
Thank you, Josef

Re: Popup window

Posted: Fri Jun 22, 2012 12:55 pm
by cmb
Hi Josef,

you can do it with hi_Fancybox. activate has to be 1. Make a new hidden CMSimple page called "Important" that contains the message. Then insert on your start page in source code mode:

Code: Select all

<a id="important" href="?Important&print">Important Message</a></p>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').fancybox().click()})
// ]]></script>
This should open the Fancybox automatically in view mode. The link is not strictly necessary, but it's probably a good idea to have it, so a visitor having JS disabled can view the message nonetheless.

Note that the <script> can not be seen in the WYSIWYG mode, so be careful to not delete it accidentially.

Christoph

Re: Popup window

Posted: Fri Jun 22, 2012 2:18 pm
by oldnema
cmb wrote:Hi Josef,

you can do it with hi_Fancybox. activate has to be 1. Make a new hidden CMSimple page called "Important" that contains the message. Then insert on your start page in source code mode:

Code: Select all

<a id="important" href="?Important&print">Important Message</a></p>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').fancybox().click()})
// ]]></script>
This should open the Fancybox automatically in view mode. The link is not strictly necessary, but it's probably a good idea to have it, so a visitor having JS disabled can view the message nonetheless.
Note that the <script> can not be seen in the WYSIWYG mode, so be careful to not delete it accidentially.
Christoph
YEP! That's what I needed, works perfectly!
Christoph, really, very, very much - Josef

Re: Popup window

Posted: Thu Oct 04, 2012 11:38 am
by mitch
Is it possible to define a class? To the link OK, it's working(see below), but I also need the class "zoom" for the pop up that opens automatically. Otherwise it opens with the default HI-fancy options and not with those that have been configured in the plugin config...

Code: Select all

<p><a class="zoom" href="?simeda:PopUp&print" id="important">Important Message</a></p>
<p>&nbsp;</p>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').fancybox().click()})
// ]]></script>

Re: Popup window

Posted: Thu Oct 04, 2012 12:08 pm
by cmb
Hi mitch,

basically that's possible. The main problem is, that the "message" fancybox is triggered from the content, but the settings of hi_fancybox are applied later (see the generated HTML source code). An additional problem is the explicit fancybox().click(), which will cause the fancybox for the message to use the fancybox defaults.

The solution: put the <script>...</script> to the template, just after the <?php echo content();?> and change it slightly:

Code: Select all

<?php echo content();?>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').click()})
// ]]></script>
On the page, you have to write only:

Code: Select all

<a class="zoom" href="?simeda:PopUp&print" id="important">Important Message</a> 
Christoph

Re: Popup window

Posted: Thu Oct 04, 2012 1:12 pm
by oldnema
Just a thought: it could be used plugin "Privacy XH" ;)
It would be an advantage in that the window popped once.
Josef

Re: Popup window

Posted: Thu Oct 04, 2012 2:46 pm
by mitch
cmb wrote:Hi mitch,

basically that's possible. The main problem is, that the "message" fancybox is triggered from the content, but the settings of hi_fancybox are applied later (see the generated HTML source code). An additional problem is the explicit fancybox().click(), which will cause the fancybox for the message to use the fancybox defaults.

The solution: put the <script>...</script> to the template, just after the <?php echo content();?> and change it slightly:

Code: Select all

<?php echo content();?>
<script type="text/javascript">// <![CDATA[
jQuery(function() {jQuery('#important').click()})
// ]]></script>
On the page, you have to write only:

Code: Select all

<a class="zoom" href="?simeda:PopUp&print" id="important">Important Message</a> 
Christoph
Thanks that works!!

Re: Popup window

Posted: Tue Nov 06, 2012 2:40 pm
by mitch
oldnema wrote:Just a thought: it could be used plugin "Privacy XH" ;)
It would be an advantage in that the window popped once.
Josef
How would that work. Thats exactly what I'm searching for now. The pop-up shoud open only once....

Re: Popup window

Posted: Tue Nov 06, 2012 3:18 pm
by cmb
Hi mitch,

Privacy_XH is primarily meant to comply to the EU cookie law (and other similar laws). But indeed it might be used for this purpose too (thanks to oldnema's creativity!). It shows the message on every page, but when the user confirms that he read it, the plugin sets a cookie in the visitor's browser. If this cookie is already set, the message won't be shown again.

You have to consider, that switching off the messages requires cookies to be enabled in the visitor's browser, and that a new message will not be shown, if the cookie is still set in the browser (you can configure the durability of the cookie in the back-end).

Christoph

Re: Popup window

Posted: Wed Nov 07, 2012 9:58 am
by mitch
cmb wrote:Hi mitch,

Privacy_XH is primarily meant to comply to the EU cookie law (and other similar laws). But indeed it might be used for this purpose too (thanks to oldnema's creativity!). It shows the message on every page, but when the user confirms that he read it, the plugin sets a cookie in the visitor's browser. If this cookie is already set, the message won't be shown again.

You have to consider, that switching off the messages requires cookies to be enabled in the visitor's browser, and that a new message will not be shown, if the cookie is still set in the browser (you can configure the durability of the cookie in the back-end).

Christoph
And how to use it concretely combined with the fancy box script from above.?