DMXzone Lightbox Support Product Page
Answered
Close event...
Asked 17 Jun 2009 16:37:10
1
has this question
17 Jun 2009 16:37:10 John Kroll posted:
Is there an onClose or Close event available for when a user closes a LightBox? I would like to redirect to a different page when it is closed. Replies
Replied 18 Jun 2009 15:03:12
18 Jun 2009 15:03:12 Miroslav Zografski replied:
Hi John,
Can you, please provide more details on your goal?
The question is why you would like to redirect from the current page when Lightbox is closed?
Regards,
Can you, please provide more details on your goal?
The question is why you would like to redirect from the current page when Lightbox is closed?
Regards,
Replied 18 Jun 2009 19:08:49
18 Jun 2009 19:08:49 John Kroll replied:
Think I've got it Miroslav, but thanks. Used an event listener
Replied 19 Jun 2009 11:14:18
19 Jun 2009 11:14:18 Miroslav Zografski replied:
Hi John,
Just bare in mind that you need to check if the Lighbox.instance is created on page and then to call event listener.
I have a ready function for that :
Regards,
Just bare in mind that you need to check if the Lighbox.instance is created on page and then to call event listener.
I have a ready function for that :
<script type="text/javascript"> $(function() { // wait for lightbox instance (function() { if (!DMX.Lightbox.instance) { window.setTimeout(arguments.callee, 800); return; } DMX.Lightbox.instance.addEventListener('contentLoaded.redirector', function(){ this.addEventListener('afterClose', function() {alert('Closed');}); }); })(); }); </script>
Regards,
Replied 08 Mar 2010 17:24:10
08 Mar 2010 17:24:10 Luca lucag replied:
Hi Miroslav
In my lightbox I open a page, that updates a recordset (with a command - ASP classic) ...
I would like (when I close the Lightbox and back to the start page), the start page being refreshed because the db is changed.
I see your code, but I don't understand how to apply this in my case...
Thank you
Regards
Luca
In my lightbox I open a page, that updates a recordset (with a command - ASP classic) ...
I would like (when I close the Lightbox and back to the start page), the start page being refreshed because the db is changed.
I see your code, but I don't understand how to apply this in my case...
Thank you
Regards
Luca
Replied 08 Mar 2010 22:12:57
08 Mar 2010 22:12:57 George Petrov replied:
Luca,
Just add target="_top" on your form in the lightbox and make sure you redirect the form to your parent page after record has being saved.
That should do it.
Greetings,
George
Just add target="_top" on your form in the lightbox and make sure you redirect the form to your parent page after record has being saved.
That should do it.
Greetings,
George
Replied 09 Mar 2010 10:21:34
09 Mar 2010 10:21:34 Luca lucag replied:
Hi George
Yes, I know this for forms and normally I do... but:
In the start page I have a link: "new message" that open lightbox.
In the lightbox page I don't have a form but a command (updates db whit read=Yes), that works automatically when this page is open.
When the lightbox is closed I need who the start page is refreshed for change the link in "already read"
And this must happen in any way I close the lightbox
Thank you
Regards
Luca
Yes, I know this for forms and normally I do... but:
In the start page I have a link: "new message" that open lightbox.
In the lightbox page I don't have a form but a command (updates db whit read=Yes), that works automatically when this page is open.
When the lightbox is closed I need who the start page is refreshed for change the link in "already read"
And this must happen in any way I close the lightbox
Thank you
Regards
Luca
Replied 10 Mar 2010 11:41:50
10 Mar 2010 11:41:50 Miroslav Zografski replied:
Hello Luca,
this function goes in the parent page head tag.
It checks if the Lightbox is closed and if it is -> refreshes the parent.
NOTE - it is window.location instead of windowwindow.location
Regards,
this function goes in the parent page head tag.
It checks if the Lightbox is closed and if it is -> refreshes the parent.
<script type="text/javascript"> $(function() { // wait for lightbox instance (function() { if (!DMX.Lightbox.instance) { window.setTimeout(arguments.callee, 800); return; } DMX.Lightbox.instance.addEventListener('contentLoaded.redirector', function(){ //when lightbox is closed this.addEventListener('afterClose', function() { //refresh the parent window.location = window.location; }); }); })(); }); </script>
NOTE - it is window.location instead of windowwindow.location
Regards,
Replied 10 Mar 2010 19:58:04
10 Mar 2010 19:58:04 Luca lucag replied:
Hi Miroslav,
I have placed the code on the "start page" (parent) (without changes except windowwindow) but after lightbox is closed the page isn't refreshed... or if it's refreshed, is only on cache.. and this isn't enough to reading the db...
Thank you
Regards
Luca
I have placed the code on the "start page" (parent) (without changes except windowwindow) but after lightbox is closed the page isn't refreshed... or if it's refreshed, is only on cache.. and this isn't enough to reading the db...
Thank you
Regards
Luca
Replied 15 Mar 2010 12:05:51
15 Mar 2010 12:05:51 Miroslav Zografski replied:
Hello Luca,
You can easily check if it refreshes the page by adding to the line
window.location = window.location + "refresh=y";
Regards,
You can easily check if it refreshes the page by adding to the line
window.location = window.location + "refresh=y";
Regards,
Replied 18 Mar 2010 21:19:09
18 Mar 2010 21:19:09 Luca lucag replied:
Hi Miroslav
No. Url is "clean" after refresh... (I have add ? in "referesh=y"
(pages in ASP/VBscript)
Thank you
Regards
Luca
No. Url is "clean" after refresh... (I have add ? in "referesh=y"
(pages in ASP/VBscript)
<script type="text/JavaScript"> <!-- function openDMXzoneLightbox(arg, options, context) {//v1.2 context = context || window, options = options || {}; if (context.DMX && context.DMX.Lightbox) { context.DMX.Lightbox.open(options.plugin || "", arg, options); document.MM_returnValue = false; } } //--> </script> <script type="text/javascript"> $(function() { // wait for lightbox instance (function() { if (!DMX.Lightbox.instance) { window.setTimeout(arguments.callee, 800); return; } context.DMX.Lightbox.instance.addEventListener('contentLoaded.redirector', function(){ //when lightbox is closed this.addEventListener('afterClose', function() { //refresh the parent window.location = window.location + "?refresh=y"; }); }); })(); }); </script>
Thank you
Regards
Luca
Replied 02 Apr 2010 00:51:50
02 Apr 2010 00:51:50 Nikolaos Beligiannis replied:
[] GREAT!!