Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: Lightbox Link Target???

  1. #1
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Unhappy Lightbox Link Target???

    Hi,
    I'm using the Lightbox v2.0 script in conjunction with an Iframe and trying to target "_parent" but I can't make it work. I've tried everything I can think of, but it's not working. Does anyone have any ideas as to what the problem could be? Here's a link to a test page so you can see what I mean...
    Temp Gallery

    Thanks in advance for any help.
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

  2. #2
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    Hey, does anybody know if it is possible to us the lightbox script inside an I-Frame, but when you click on the link for the lightbox script to target the _parent window? I've tried numerous methods, yet none work. The above link to a "temp gallery" doesn't run an IFrame anymore, I took out the IFrame utnil I can get this figured out... Thanks.
    --------------------------------------------------
    Reviews, Interviews, Tutorials, and STUFF
    --------------------------------------------------
    Home of the SexyBookmarks WordPress plugin

  3. #3
    Join Date
    Mar 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Solution

    Hi, This is pretty old, but I was looking of exactly the same thing! I found something that works great for me. Here is the method:
    1. Load the scripts and css needed to run lightbox in the parent page
    2. Create a function in the parent page like the one below:
    function openImage(input)
    {
    myLightbox.start(input);
    return false;
    }
    3. Inside the iframe page write links of the following format:
    HTML Code:
    <a link="images\target_image.jpg" rel="lightbox" onClick="self.parent.openImage(this)"  OnMouseOver="this.className='cursor';" style="cursor:pointer;cursor:hand;"><img src="images\target_image_small.jpg"></a>
    4. Modify file lightbox.js :
    on line 331, replace: imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
    with: imageArray.push(new Array(imageLink.getAttribute('link'), imageLink.getAttribute('title')));

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This mod:

    http://www.dolem.com/lytebox/

    works in an iframe.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Zoumbatianos Kostas View Post
    Hi, This is pretty old, but I was looking of exactly the same thing! I found something that works great for me. Here is the method:
    1. Load the scripts and css needed to run lightbox in the parent page
    2. Create a function in the parent page like the one below:
    function openImage(input)
    {
    myLightbox.start(input);
    return false;
    }
    3. Inside the iframe page write links of the following format:
    HTML Code:
    <a link="images\target_image.jpg" rel="lightbox" onClick="self.parent.openImage(this)"  OnMouseOver="this.className='cursor';" style="cursor:pointer;cursor:hand;"><img src="images\target_image_small.jpg"></a>
    4. Modify file lightbox.js :
    on line 331, replace: imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
    with: imageArray.push(new Array(imageLink.getAttribute('link'), imageLink.getAttribute('title')));
    hey.

    Have no idea if you read this or not....

    I tryied to do this, but my lightbox didn´t have the same text at the line 331, and not anywhere else either. =0(

    I am having problems with the iframe and the lightbox...

    thanx.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There are quite a number of versions of lightbox out there. The line number(s) for, and the exact code syntax used for doing:

    Code:
    imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
    vary. Some may not even do that particular thing at all, dealing with the issue of getting the href and title (if any) in a different manner.

    However, Zoumbatianos Kostas' idea is a pretty good one and should work with at least some lightbox version(s) prior to 2.04 (all of them, provided the myLightbox.start() function or an equivalent is available or is made available in the global scope). Now I'm referring only to the official lightbox scripts, not to any of its many 'clones' and imitators, though a similar strategy may work with them.

    In fact, with the version Zoumbatianos Kostas was using, no modification would be needed to line 331. One could instead follow the rest of his adaptation, but use this type link in the iframe:

    Code:
    <a href="images\target_image.jpg" rel="lightbox" 
    onclick="self.parent.openImage(this);return false;"
    ><img src="images\target_image_small.jpg"></a>
    This script though (a lightbox 'clone'):

    http://www.dolem.com/lytebox/

    already has the iframe functionality built in, though it can be a little tricky to implement. The iframe must have a name attribute, a fact which I believe is left unmentioned on the demo page and only hinted at due to its use in the demo code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Dec 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yeah, I know.
    This is the one I use for the moment (http://www.lokeshdhakar.com/projects/lightbox2/).

    Could you help me to get it right...?
    If not I have to take a look at the other one.

    Thanx.

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That version of Lightbox (2.04), though it has some significant bugs, supports AJAX imported content, making iframe (which is being deprecated anyway) unnecessary.

    However, if you aren't ready to 'graduate' to using AJAX, I have figured out how to get my version v2.04a (which is still AJAX friendly, also has numerous other added features and bug fixes) to work with iframe.

    Demo:

    http://home.comcast.net/~jscheuer1/s...ight_frame.htm

    Archive:

    http://home.comcast.net/~jscheuer1/s...htbox2.04a.zip

    There is an added script on light_externl.htm. Put that in the head of your iframe page. Otherwise, just install Lightbox 2.04a as usual on the top page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Dec 2008
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanx for answering and helping.

    I´m just a beginner and if you say that I have to "graduate" to use the Ajax, then I maby should try it. Is it the lytebox or what exactly is the "Ajax"?

    I´m just a regular homepagemaker, not an expert, especially this "lightbox" is quite new for me.

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Well the newer lightbox versions (2.04 from the author, and 2.04a - my updated and bug fixed version) use a different strategy for opening the lightbox. Instead of assigning events to each lightbox link, they listen for clicks on the page. If one of these happens to be on a lightbox link, they open its href in the lightbox.

    Because of that one can import content to the page that uses the lightbox syntax and it will be still be active without additional initialization.

    A good basic AJAX routine is here:

    http://www.dynamicdrive.com/forums/s...9&postcount=16

    Once you have that on your page, just make up a division like:

    HTML Code:
    <div id="targetarea"></div>
    You can then have a link:

    Code:
    <a href="external_light_box_content.htm" onclick="new loadXmlHttp(this.href, 'targetarea');return false;>Link Text</a>"
    It will bring the external_light_box_content.htm into the targetarea div. If the external_light_box_content.htm has lightbox links on it, and the lightbox 2.04a script is installed on the 'top' page, the imported lightbox links will work.

    I recommend using my 2.04a version because of its bug fixes and added features. But for a basic installation, the author's 2.04 version will work in most cases.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •