|
|
|
View previous topic
::
View next topic
|
| Author |
Message |
ramon fincken Site's programmer
 Get a free globally recognized avatar It's free!
Joined: 03 Aug 2007 Posts: 281 Location: A'dam/Diemen, The Netherlands
|
Posted: Sat Feb 21, 2009 11:32 pm Post subject: [solution] Calling prototype lightwindow AFTER an AJAX call |
|
|
Well heck... it appeared that the beautifull lightwindow:
http://stickmanlabs.com/2007/07/10/ligh...-released/
http://www.stickmanlabs.com/lightwindow/#demos
[solution below]
was NOT capable of this scenario:
* HTML page (with all correct paths) with an AJAX triggered content page
* content page had a lightwindow link
lightwindow link would open in the same _parent window and not as the neat overlay we want to create.
What I did:
* change the params to iframe calls
* included the code in the to be called content page
However ... Well RTFM (Read The Fucking Manual) or in this case ... read the user comments on the blog.
I found out that Bart Joosten suggested creating a NEW window object after the completion of the AJAX request ...
| permalink wrote: | | @Tim: This is not a problem of lightwindow. If you do an AJAX update on your page it gets loaded with new objects. But a window load event won’t fire. So lightwindow isn’t reïnitialized with the new objects. |
This got me thinking and I opened the lightwindow.js source code... At the very bottom you'll see :
| Code: | Event.observe(window, 'load', lightwindowInit, false);
//
// Set up all of our links
//
var myLightWindow = null;
function lightwindowInit() {
myLightWindow = new lightwindow();
} |
Tataa!! Solution !
So I combined the two et voila!
So... my new JavaScript looks like this: ( note the " onComplete:function(){ lightwindowInit(); } " )
| Code: | new Ajax.Updater
(
'step0_result', url_ajax_step0 + 'action=showkaartafmetingen&cat_id='+ escape(cat_id),
{ onComplete:function(){ lightwindowInit(); } }
); |
And my code in the page is :
| Code: | | a class="lightwindow page-options" href="kies_tussenscherm.php" title="Kies dit formaat" params="lightwindow_type=external,lightwindow_width=600" rel="nofollow" |
Solution crosslinked at
http://stickmanlabs.com/2007/07/10/ligh...mment-1182 |
|
| Back to top |
|
 |
Google adsense Advertisement
|
Posted: Sat Feb 21, 2009 11:32 pm Post subject: [solution] Calling prototype lightwindow AFTER an AJAX call |
|
|
Advertisement
|
|
| Back to top |
|
 |
GravityForms Advertisement
|
Posted: Sat Feb 21, 2009 11:32 pm Post subject: [solution] Calling prototype lightwindow AFTER an AJAX call |
|
|
Advertisement
 |
|
| Back to top |
|
 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|