SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    jQuery - script not running properly on initial AJAX load

    Hello,

    I've got a problem on a site using AJAX navigation where when you first request a page, parts of the script haven't been executed, but if you visit again, it's fine. Is there a common pitfall causing this problem?

    Cheers,

    Jon

  2. #2
    SitePoint Zealot
    Join Date
    Jun 2008
    Location
    Gloucestershire, UK
    Posts
    197
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found the problem, the script is actually measuring the width of the content then displaying it with a controller to navigate through it. The problem is that it's measuring the width before the images have loaded meaning that I'm getting the wrong result and causing the bug. I've dealt with this outside the AJAX call by using $(window).load() but this doesn't seem to work within the AJAX call, any idea how I can delay the script until all the images have been loaded?

    Cheers,

    Jon


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
  •