Hi, I am trying to include lightbox functionality in my app, but there is a slight complication. Apparently lightbox initializes all the links to lightbox events on page load. However, in my case, some new links to lightbox events will be rendered to the page through ajax events (obviously this means after the page loads). So I figure I need to find a way to call lightbox''s initialize() function with every ajax response. So I am trying to call this function from RJS. Here''s my code: page << ''intialize()'' This gives me the following error (in Firefox): RJS error: Reference Error: initialize is not defined. So I guess it''s interpreting as an rjs call rather than simply javascript. In a previous post I read that the syntax above would allow one to using custom javascript, but it doesn''t seem to be the case here. Any ideas? Thanks, Sean
Hi, I am trying to include lightbox functionality in my app, but there is a slight complication. Apparently lightbox initializes all the links to lightbox events on page load. However, in my case, some new links to lightbox events will be rendered to the page through ajax events (obviously this means after the page loads). So I figure I need to find a way to call lightbox''s initialize() function with every ajax response. So I am trying to call this function from RJS. Here''s my code: page << ''intialize()'' This gives me the following error (in Firefox): RJS error: Reference Error: initialize is not defined. So I guess it''s interpreting as an rjs call rather than simply javascript. In a previous post I read that the syntax above would allow one to using custom javascript, but it doesn''t seem to be the case here. Any ideas? Thanks, Sean
Sean O''Hara wrote:> Hi, > > I am trying to include lightbox functionality in my app, but there is > a slight complication. Apparently lightbox initializes all the links > to lightbox events on page load. However, in my case, some new links > to lightbox events will be rendered to the page through ajax events > (obviously this means after the page loads). So I figure I need to > find a way to call lightbox''s initialize() function with every ajax > response. So I am trying to call this function from RJS. Here''s my code: > page << ''intialize()'' > > This gives me the following error (in Firefox): > RJS error: > Reference Error: initialize is not defined.Lightbox collects all of it''s magic within a Lightbox object, so you need to say Lightbox.initialize() instead. And hello to the rails list; I''m new here. phil -- Phillip Kast (909)630-9562 phil@unimedia.org
page << "initLightbox();" Works for me. :) Ilya -- Posted via http://www.ruby-forum.com/.
Thanks Ilya, In my case, that still throws an RJS error: Reference Error: initLightbox is not defined. I have another RJS declaration above: page["release#{@release.id}"].replace_html :partial => ''edit_release'', :object => @release Maybe it''s no good to mix RJS with custom javascript? Did you define initLightbox anywhere? Thanks, Sean On 28-May-06, at 2:17 PM, Ilya Grigorik wrote:> page << "initLightbox();" > > Works for me. :) > > Ilya > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Ilya, I take it back. The double quotes worked fine with my original declaration. I guess we''re using different Lightbox scripts. I using particle tree''s which has a function named initialize rather than initLightbox. Take care, Sean On 28-May-06, at 2:26 PM, Sean O''Hara wrote:> Thanks Ilya, > > In my case, that still throws an RJS error: > Reference Error: initLightbox is not defined. > > I have another RJS declaration above: > page["release#{@release.id}"].replace_html :partial => > ''edit_release'', :object => @release > > Maybe it''s no good to mix RJS with custom javascript? Did you > define initLightbox anywhere? > > Thanks, > Sean > > > On 28-May-06, at 2:17 PM, Ilya Grigorik wrote: > >> page << "initLightbox();" >> >> Works for me. :) >> >> Ilya >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Glad it worked.. Just out of curiosity, are you using lightbox gone wild? You might want to check out the new/fresher release (v.2.x) over at: http://www.huddletogether.com/projects/lightbox2/ Gone wild is based on v.1 Cheers, Ilya -- Posted via http://www.ruby-forum.com/.
Or you might want to use the original modal that I wrote :) http://www.subimage.com/sublog/subModal On 5/28/06, Ilya Grigorik <ilya@fortehost.com> wrote:> > Glad it worked.. Just out of curiosity, are you using lightbox gone > wild? > > You might want to check out the new/fresher release (v.2.x) over at: > http://www.huddletogether.com/projects/lightbox2/ > > Gone wild is based on v.1 > > Cheers, > Ilya > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- seth at subimage interactive http://www.subimage.com/sublog/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060528/0e79e36a/attachment.html
Hi Ilya, Yes, I''m using lightbox gone wild because it supports the use lightboxes for non-image content. I didn''t see any mention of that at the lightbox v.2 page. Have you used it for non-image content such as partials, etc.? Best, Sean On 28-May-06, at 2:36 PM, Ilya Grigorik wrote:> Glad it worked.. Just out of curiosity, are you using lightbox gone > wild? > > You might want to check out the new/fresher release (v.2.x) over at: > http://www.huddletogether.com/projects/lightbox2/ > > Gone wild is based on v.1 > > Cheers, > Ilya > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Ah, I see.. No I don''t need that functionality in my current project.. But again, you may want to take a look at: http://codylindley.com/Javascript/257/thickbox-one-box-to-rule-them-all Cheers, Ilya -- Posted via http://www.ruby-forum.com/.
Hi Ilya, Have you been able to deactivate a lightbox through rjs? I''ve tried page << "lightbox.deactivate;" page << "deactivate;" page << "lightbox.end;" None of this do the trick. There is a deactivate function in the lightbox script that I am using, but I can''t seem to call it (unlike the initialize function. Any thoughts? Thanks, Sean On 28-May-06, at 2:36 PM, Ilya Grigorik wrote:> Glad it worked.. Just out of curiosity, are you using lightbox gone > wild? > > You might want to check out the new/fresher release (v.2.x) over at: > http://www.huddletogether.com/projects/lightbox2/ > > Gone wild is based on v.1 > > Cheers, > Ilya > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hi All, I found the answer to my own question. It''s simply: page << "lightbox.prototype.deactivate();" Thanks, Sean On 29-May-06, at 11:14 AM, Sean O''Hara wrote:> Hi Ilya, > > Have you been able to deactivate a lightbox through rjs? I''ve tried > page << "lightbox.deactivate;" > page << "deactivate;" > page << "lightbox.end;" > > None of this do the trick. There is a deactivate function in the > lightbox script that I am using, but I can''t seem to call it > (unlike the initialize function. Any thoughts? > > Thanks, > Sean > > On 28-May-06, at 2:36 PM, Ilya Grigorik wrote: > >> Glad it worked.. Just out of curiosity, are you using lightbox gone >> wild? >> >> You might want to check out the new/fresher release (v.2.x) over at: >> http://www.huddletogether.com/projects/lightbox2/ >> >> Gone wild is based on v.1 >> >> Cheers, >> Ilya >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Another solution would be to use an AJAX auto responder where in you would run the lightbox intialize whenever an AJAX request (on)Complete. This is useful when there are a large number of lightbox links involved in each AJAX result. -- Posted via http://www.ruby-forum.com/.
For regular divs I prefer my lightbox solution over particle tree''s, because it''s quite a bit simpler. http://pjhyett.com/articles/2006/02/09/the-lightbox-effect-without-lightbox -PJ On 5/29/06, cyx <cyx.ucron@gmail.com> wrote:> Another solution would be to use an AJAX auto responder where in you > would run the lightbox intialize whenever an AJAX request (on)Complete. > This is useful when there are a large number of lightbox links involved > in each AJAX result. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Thanks PJ. Indeed your solution fits my needs far better because it''s much simpler. No need to run the initialize() function every time new content is added to the page through ajax requests. Take care, Sean On 29-May-06, at 6:08 PM, PJ Hyett wrote:> For regular divs I prefer my lightbox solution over particle tree''s, > because it''s quite a bit simpler. > > http://pjhyett.com/articles/2006/02/09/the-lightbox-effect-without- > lightbox > > -PJ > > On 5/29/06, cyx <cyx.ucron@gmail.com> wrote: >> Another solution would be to use an AJAX auto responder where in you >> would run the lightbox intialize whenever an AJAX request (on) >> Complete. >> This is useful when there are a large number of lightbox links >> involved >> in each AJAX result. >> >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails