Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I received a feature request in the Splash module issue queue to offer Lightbox in addition to Thickbox as an option for displaying splash pages. I'm having a very difficult time figuring out how to do this because it appears that Lightbox2 is entirely link oriented - I can not find any way to invoke it from a javascript event (i.e. document.ready). Is there something I'm missing here or is this just not possible with Lightbox2?
Comments
Comment #1
stella CreditAttribution: stella commentedCheck out the documentation at http://drupal.org/node/316727
Basically if the content you want to display in a lightbox is in a div like
<div id="lightboxAutoModal" rel="lightmodal[|height: 50px;]">
then it will open up on page load. You can configure the height and width via the rel attribute.Comment #2
tiato CreditAttribution: tiato commentedI know you must be tiring of answering these questions but I too cannot get the lightbox to auto load whatsoever. I would like to auto load an image inside a lightbox when the page loads but figured I need to start at basics and try to generate any auto loaded lightbox so I aimed with attempting to auto load $messages to no avail.
I added the following to page.tpl.php:
The above does not work instead no messages are displayed unless I remove 'style="display:none;"' then I can see messages again on the page but there is no lightbox. Lightbox works fine, as it should, with images and modals which is really what I use it for but none of the auto load recommendations I have tried have worked.
Source does look like it's tagging the line I added in page.tpl.php but there is no lightbox-processed? Is this okay?
I have also tried applying patch lightbox2_6x_294361.patch which added the following line to the end of lightbox.js:
I would really very much like to get this working. I love your lightbox module and i'm starting to think maybe something is conflicting with lightbox? I do use the jquery_update module, I do remember you asked someone about that, could this be my problem?
I'm using the following:
Drupal 6.14
Lightbox2 6.x-1.9
JQuery plugins 6.x-1.10
JQuery Update 6.x-1.1
Image Assist 6.x-3.x-dev
CTools 6.x-1.0
CCK 6.x-3.x-dev
I tried to avoid posting a Q but I have tried everything listed in the issues and the lightbox documentation to avoid posting a q but I am now at a loss. Thank you in advance for your help and thank you for bothering to code this module in the first place. It works great just the auto-load is a bit tricky, eh? :)
If you need more info let me know. Got tons. :)
Comment #3
stella CreditAttribution: stella commentedAny chance you could try the dev version?
Comment #4
tiato CreditAttribution: tiato commentedStella,
Thanks for your response, will def try the dev, give me a couple days and I'll post the outcome
Comment #5
tiato CreditAttribution: tiato commentedUpdate:
I tried the dev version and sure enough AutoModal works fine with images inserted using img_assist, I couldn't get messages working but I neither needed it or spent as much time with. And it may be worth noting that not only is the AutoModal working I am using the Insert Node filter so my code to actually call the lightbox looks like follows:
Here are the contents of node 12:
Now the only thing I wonder is if the ability to click vertical/horizontal scrollbars on/off is planned for the future? eh? ;) not critical and I will not delay production for it plus I believe if I use 'rel=' to resize the AutoModal box it should be a band-aid fix at the least, yes? Also, rounded corners would be cool. For future reference of course.
Thanks stella, dev is working as expected. i should note that I did remove
code below
from my page.tpl.php file as I was getting a blank white Modal when the lines were in, set back to default:changed to:
Thanks stella, you're fantastic
Comment #6
tiato CreditAttribution: tiato commentedQuick question: Has this been committed to the latest version of Lightbox2 or should I keep using the dev version?
Thanks stella!
Comment #7
tiato CreditAttribution: tiato commentedComment #8
tiato CreditAttribution: tiato commentedComment #11
Road Kill CreditAttribution: Road Kill commentedI am trying to get a page to fire in a light box when somebody arrives at landing page of a website.
The light box works but appears to not respect the URL. Any suggestions or tips would be most appreciated.
My approach was the following but I think I might be missing something. I put the code below in a tpl the light box works but no joy with the URL.
Comment #12
Road Kill CreditAttribution: Road Kill commentedOkay I have been using the code below to call the node but I am actually trying to open the full node in the lightbox, but at the moment I have had to put text asking to click to view the full node this is not really desirable.