Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 35

Thread: Ajax + lightbox

  1. #21
    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

    I see now. This is different than what we had earlier in this thread because this AJAX script rewrites the link's attributes. You could probably get away with something like so:

    HTML Code:
    <li><a href="test.htm" rel="ajaxcontentarea"><span onclick="pollContent('test1');">External content</span></a></li>
    But, more work may be needed.
    - John
    ________________________

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

  2. #22
    Join Date
    Aug 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1
    I see now. This is different than what we had earlier in this thread because this AJAX script rewrites the link's attributes. You could probably get away with something like so:

    HTML Code:
    <li><a href="test.htm" rel="ajaxcontentarea"><span onclick="pollContent('test1');">External content</span></a></li>
    But, more work may be needed.
    i could kisss you ! BUT that problem where occurs when you return to the tab a second time it doesnt execute

    first time loads ok upon return it just opens in new window

    http://www.mediapixel.co.uk/portfolio.htm

    external content 2 tab ^^^

  3. #23
    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

    I see why that is happening, it is similar to a problem we had with the other AJAX script. If you go back to internal and then to external, it will work. The problem only arises when you are replacing the external with the same external. To fix that we need to prevent our poll from firing too soon when identical content is loaded, try changing the pollContent() function like so:

    Code:
    function pollContent(id){
    if(document.getElementById(id)){
    initLightbox();
    document.getElementById(id).id="";
    }
    else
    setTimeout("pollContent('"+id+"')", 60)
    }
    That should take care of it.

    Added:

    In case you don't already known, you have to use a different (unique) id for each external page's test span, especially not one in use on the 'top' page. With the above change to pollContent, we probably could get away with the same test span id for all external content pages but, best to be on the safe side.
    Last edited by jscheuer1; 08-04-2006 at 10:29 AM. Reason: add info
    - John
    ________________________

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

  4. #24
    Join Date
    Aug 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Quote Originally Posted by jscheuer1
    I see why that is happening, it is similar to a problem we had with the other AJAX script. If you go back to internal and then to external, it will work. The problem only arises when you are replacing the external with the same external. To fix that we need to prevent our poll from firing too soon when identical content is loaded, try changing the pollContent() function like so:

    Code:
    function pollContent(id){
    if(document.getElementById(id)){
    initLightbox();
    document.getElementById(id).id="";
    }
    else
    setTimeout("pollContent('"+id+"')", 60)
    }
    That should take care of it.

    Added:

    In case you don't already known, you have to use a different (unique) id for each external page's test span, especially not one in use on the 'top' page. With the above change to pollContent, we probably could get away with the same test span id for all external content pages but, best to be on the safe side.
    works like a dream, i cant thank you enough, have a good weekend

  5. #25
    Join Date
    Sep 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi,

    i think i'm having the same problem as waynep. when i followed the instructions you have him, it opens a new page instead of running through the ajax script. can you look at it and tell me what i did wrong please?

    66mott.com and then click on gallery.

    thanks,

  6. #26
    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

    Works here.
    - John
    ________________________

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

  7. #27
    Join Date
    Sep 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax + lightbox

    hi John,

    it works now because i bypassed it by pointing gallery to the index.php page. i noticed that the only page capable of playing the lightbox is the index.php page so i had to do that in the meantime. i'll change it back to linking gallery to its own gallery.html page and you will see the problem.

    thanks!

  8. #28
    Join Date
    Sep 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax + lightbox

    here is the ajax code i have currently.
    <script type="text/javascript">
    function pollContent(id){
    if(document.getElementById(id)){
    initLightbox();
    document.getElementById(id).id="";
    }
    else
    setTimeout("pollContent('"+id+"')", 60)
    }
    </script>

    <li><a href="javascript:ajaxpage('../menufolder/gallery.html', 'contentarea');">Gallery</a></li>
    <li><a href="javascript:ajaxpage('../menufolder/press.html', 'contentarea');">Press Review</a></li>
    </ul>


    i tried changing it to the following like how you advised waynep.


    <li><a href="test.htm" rel="ajaxcontentarea"><span onclick="pollContent('test1');">External content</span></a></li>

    but this still doesnt work.

  9. #29
    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 thread was one of several developmental threads. A more complete how to and why is found here:

    http://www.dynamicdrive.com/forums/s...ad.php?t=13003
    - John
    ________________________

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

  10. #30
    Join Date
    Sep 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi John,

    after reading the development thread, i still can't figure out how to resolve the problem. when i click on an link to an image, it still shows up on a new page. i cant get lightbox to work on it. is there some changes that i need to make on it?

    thanks,

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
  •