Question

I want to use the load() function from jQuery to get images from address, for example load-images.php

load-images.php looks like:

<div id="smth">

    <p><img src="images/test1.jpg" /></p>
    <p><img src="images/test2.jpg" /></p>
    <p><img src="images/test3.jpg" /></p>
    <p><img src="images/test4.jpg" /></p>
    <p><img src="images/test5.jpg" /></p>
    <p><img src="images/test6.jpg" /></p>
    <p><img src="images/test7.jpg" /></p>
    <p><img src="images/test8.jpg" /></p>
    <p><img src="images/test9.jpg" /></p>
    <p><img src="images/test10.jpg" /></p>

</div>

I need to make a function that reads all images from file load-images.php and use them in slider script (Basic jQuery Slider). I want loaded images use in slider.

Here is LIVE DEMOS:
1) http://spijay.com/demo/stackoverflow-01.05.2014/load-images.php
2) http://fiddle.jshell.net/744Ew/show/ (same demo in jsfiddle.net for making working example)

So far i made this code:

Was it helpful?

Solution

I have used a different slider Cycle2 but try:

$(document).ready(function() {

setTimeout(function() {

    $('#loading').fadeOut(400, function() {

        $(this).remove();

        $('#container').load('http://fiddle.jshell.net/744Ew/show/ img', function() {

            $('#container').cycle({  speed: 600 });

        });

    });

}, 1000);

});

http://jsfiddle.net/47FP2/9/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top