A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: ajax and javascript (lightbox)

  1. #1
    Junior Member
    Join Date
    Feb 2004
    Posts
    12

    ajax and javascript (lightbox)

    Hi,

    I have a web page that is updated using ajax, but i want to use a pop up ligthbox for photo's etc.

    lightbox works fine if the required attributes for a picture to open on a link are in the main page. But if a link that was got from the server using ajax will not work.

    I was thinking it might be because i should eval the responcetext form the server. But none of the text is javascript the links just have the extra 'rel' attribute included.

    Any ideas?

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    Which specific Lightbox script are you using? Most of them come with a function that you can call to reinitialize the listeners. What's happening is the events are bound to the current links in your DOM, but when new ones are added, they need to be told those are Lightbox elements manually.

  3. #3
    Junior Member
    Join Date
    Feb 2004
    Posts
    12
    Hi taco,

    I am actually using lytebox v3.2.
    http://www.dolem.com/lytebox/

    I assume you are talking about the initLytebox() function? I did try this in the onload attribute but of course this doesn't make any difference when a ajax function runs.

    How do I get this to run after each ajax update? Can i add it to the end of my ajax function? If so how do I call a javascript function in another file?

    Or maybe you know of a better way?

    Thanks
    bmcomp

  4. #4
    Junior Member
    Join Date
    Feb 2004
    Posts
    12
    Looks like I managed to get it to work. I just added initLytebox() to the end of my stateChanged function after it updates the page. I didn't think it would pick up the initLytebox function from within my ajax script file. But it does!

    Thanks for the help.
    B

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center