Top Poster
#1 ramon fincken 400
#2 Site admin 3
#3 Ber|Art 2
#4 braddmark 1
#5 accentmedia 1
#6 Xarzu 1
#7 pEcosespedex 1
#8 khadish 1
#9 moxxx 1
#10 nistelrock 1
[solution] Calling prototype lightwindow AFTER an AJAX call



Rating : 4.4 / 5

 
Post new topic   Reply to topic    Ramonfincken.com Forum Index -> HTML and other markup&programming languages
Beta
Want to be notified by email when this topic gets a reply?  
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: 400
Location: A'dam/Diemen, The Netherlands

PostPosted: Sat Feb 21, 2009 11:32 pm    Post subject: [solution] Calling prototype lightwindow AFTER an AJAX call Reply with quote

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
View user's profile Send private message Visit poster's website
Google adsense
Advertisement





PostPosted: Sat Feb 21, 2009 11:32 pm    Post subject: [solution] Calling prototype lightwindow AFTER an AJAX call

Advertisement
Back to top
GravityForms
Advertisement





PostPosted: Sat Feb 21, 2009 11:32 pm    Post subject: [solution] Calling prototype lightwindow AFTER an AJAX call

Advertisement
Gravity Forms Plugin for WordPress
Back to top
Post new topic   Reply to topic    Ramonfincken.com Forum Index -> HTML and other markup&programming languages All times are GMT
Page 1 of 1

 
Jump to:  
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
General forums
The world of freelance
Programming
Other projects
Poll
I love gifts

Yes goodies and presents! [3]
No but I love polls ! [1]

Related google ads