Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Jquery cycle plugin loading in ajax content

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34193
    Olly
    Member

    Hi everyone, im having trouble loading in content from a perl script with ajax into a webpage.

    Im trying to create a dynamic slideshow when shows the most recent properties uploaded to the website.

    I have a perl script set up to print the data which consists of images and description text.

    I then call the jquery to get the data and place it in a Div on the page

    here is how the jquery looks…

    var $j = jQuery.noConflict();
    setTimeout(function() {
    $j.get("cgi-bin/properties-for-sale-rent/latest-instructions-2.pl", function(data)
    {
    $j('#slider').html(data);
    setTimeout(function() {
    // Do something after 5 seconds
    $j('#slider').cycle({ fx: 'scrollLeft',
    cleartype: true,
    cleartypeNoBg: true,
    pager: '#li-number2',
    requeueOnImageNotLoaded: true,
    });
    }, 2000);
    });
    },2000);

    My problem is that sometimes the content will fully load in and everything is fine and then sometimes the content will load in, but half of it is chopped off. Its really odd.

    I can’t get my head round it

    Any suggestions :) ?

    #87093
    Olly
    Member

    I have solved it now, the plugin was running before the page had fully loaded,

    i simply added this to the code

    $(window).bind("load", function() {
    $('#slider').cycle({
    fx: 'scrollLeft',
    cleartype: true,
    cleartypeNoBg: true,
    pager: '#li-number2',
    requeueOnImageNotLoaded: true
    });
    });
    #96271
    j0e
    Member

    Olly, thanks for following up. Quick question on the AJAX behavior here- does your code allow for the page to quickly load on older browsers (IE8 and older) because it doesn’t require all the images on the HTML page to be downloaded before viewing it?

    I’m assuming that the content you’re loading is a giant UL with LIs inside, once it’s loaded you immediately trigger the cycle. Interestingly you also have a pager involved. The content you have in the pager…is that AJAX’d in as well with everything else?

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.