Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8872137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:09:13+00:00 2026-06-14T18:09:13+00:00

Hi I currently have a jquery image slider script that pulls images from a

  • 0

Hi I currently have a jquery image slider script that pulls images from a folder and shows them on a page.

Here is the webpage with the working image slider: http://iseeit.no/slidertest/

What I want and have been trying to figure out is to have 9 individual sliders on the same page, here is an example picture that shows how it should look like:

each of the grey boxes represents the sliders

Now I’ve been trying to make a new div for each slides, but I can’t figure out how to do it…

Here is the index.php script:

Slideshow

<script src="scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="scripts/jquery.cycle.all.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('#myslides').cycle({
    fit: 1, pause: 2, timeout: 100
    });
});
</script>
<link rel="stylesheet" href="styles/dynamicslides.css" type="text/css" media="screen" />


</head>
<body>

<?php
$directory = 'images/slideshow';    
try {       
    // Styling for images   
echo "<div id=\"myslides\">";   
foreach ( new DirectoryIterator($directory) as $item ) {            
    if ($item->isFile()) {
        $path = $directory . "/" . $item;   
        echo "<img src=\"" . $path . "\" />";   
    }
}   
echo "</div>";
}   
catch(Exception $e) {
echo 'No images found for this slideshow.<br />';   
}
?>

</body>
</html>

Here is the CSS coding:

#myslides {

padding: -8px;
margin: -8px;

} 


#myslides img {

}

So I was wondering how I would do this? I’ve tried to make a new div but I don’t hvae so much experience with php, so I don’t think I’m doing it right…

Would love to get some feedback and some help with this.

Here is all the files that has to do with the script:
http://iseeit.no/files/slidertest.rar

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:09:14+00:00Added an answer on June 14, 2026 at 6:09 pm

    If I get your question right, then you have one working slider and want more of them on one page next to each other. If so then you can do it like so:

    PHP:

        // set the directories of the sliders you want
        $directories = array('images/slideshow', 
                             'images/slideshow2',
                             'images/slideshow3',
                             'images/slideshow4',
                             'images/slideshow5');    
    
        //create all the image sliders
        foreach($directories as $dir) {
            try {       
                echo '<div class="myslides">';   
    
                //add slides
                foreach( new DirectoryIterator($dir) as $item ) {            
                    if ($item->isFile()) { 
                        echo '<img src="' . $dir . '/' . $item. '" />';   
                    }
                }   
    
                echo '</div>';          
            } catch(Exception $e) {
                //do nothing, just skip the slider
            }
        }
    

    And set the jQuery plugin for the slider on the class myslides like so:

        <script>
            $(document).ready(function() {
                $('.myslides').cycle({
                    fit: 1, pause: 2, timeout: 100
                });
            });
        </script>
    

    You can use floats to place the sliders next to each other. Best practice would be an ul with the sliders as an li. But i left it as an div for now. You can get them next to each other with this CSS:

    .myslides {
        float: left;
        margin: 0 10px 10px 0; //top, right, bottom, left
        width: 200px; //set the width and height of the sliders (or maybe the slider is doing it?)
        height: 400px;
    }
    

    Hope this helps!

    update: example code to create 3×3

    $directories = array(0, 1, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7);
    $i = 0;
    echo '<ul>';
    
    foreach($directories as $dir) {
        // devide $i by 3, is the outcome 0?
        if($i % 3 == 0 && $i != 0) {
            //end row
            echo '</li>';
    
            //are there more items for the next row?
            if($i != count($directories)) {
                echo '<li>';
            }
        } elseif($i == 0) {
            echo '<li>';
        }
    
        // your code
        echo 'Jeah!';
    
        $i++; //add one 
    }
    
    //close last element and list
    echo '</li></ul>';
    

    Output:

    <ul>
        <li>Jeah!Jeah!Jeah!</li>
        <li>Jeah!Jeah!Jeah!</li>
        <li>Jeah!Jeah!Jeah!</li>
        <li>Jeah!Jeah!Jeah!</li>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have currently implemented this image slider http://www.dreamcss.com/2009/04/create-beautiful-jquery-sliders.html on a site but for some
currently I am working on an image slider with jquery. I have downloaded the
I have created a script that slides images. Each image is contained in a
I currently have an asp form that uses jquery for two elements: an image
I am creating my own carousel slideshow for images, using Jquery. Currently i have
I have a fancy web page with lots on JQuery included. Currently i am
I have got a jquery image slider on my webpage , when i try
I have some jQuery that creates a slideshow using BX slider for an unknown
currently I have the a basic jQuery gallery: <ul> <li>IMAGE</li> <li>IMAGE</li> </ul> // with
On a page I have multiple Jquery UI Sliders that fade out/in the opacity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.