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

  • SEARCH
  • Home
  • 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 996445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:52:38+00:00 2026-05-16T06:52:38+00:00

How can I transform jQuery carousel to show 3×3 square of images instead of

  • 0

How can I transform jQuery carousel to show 3×3 square of images instead of 1×3?

From:

<- |image| |image| |image| ->

To:

   |image| |image| |image|
<- |image| |image| |image| ->
   |image| |image| |image|

My source code is like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />

  <link rel="stylesheet" href="css/style.css" type="text/css" />

  <!--[if IE 6]>
  <link rel="stylesheet" type="text/css" href="css/ie6.css" />
  <![endif]-->

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script type="text/javascript">

$.fn.infiniteCarousel = function () {

    function repeat(str, num) {
        return new Array( num + 1 ).join( str );
    }

    return this.each(function () {
        var $wrapper = $('> div', this).css('overflow', 'hidden'),
            $slider = $wrapper.find('> ul'),
            $items = $slider.find('> li'),
            $single = $items.filter(':first'),

            singleWidth = $single.outerWidth(), 
            visible = Math.ceil($wrapper.innerWidth() / singleWidth), // note: doesn't include padding or border
            currentPage = 1,
            pages = Math.ceil($items.length / visible);            


        // 1. Pad so that 'visible' number will always be seen, otherwise create empty items
        if (($items.length % visible) != 0) {
            $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
            $items = $slider.find('> li');
        }

        // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
        $items.filter(':first').before($items.slice(- visible).clone().addClass('cloned'));
        $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
        $items = $slider.find('> li'); // reselect

        // 3. Set the left position to the first 'real' item
        $wrapper.scrollLeft(singleWidth * visible);

        // 4. paging function
        function gotoPage(page) {
            var dir = page < currentPage ? -1 : 1,
                n = Math.abs(currentPage - page),
                left = singleWidth * dir * visible * n;

            $wrapper.filter(':not(:animated)').animate({
                scrollLeft : '+=' + left
            }, 500, function () {
                if (page == 0) {
                    $wrapper.scrollLeft(singleWidth * visible * pages);
                    page = pages;
                } else if (page > pages) {
                    $wrapper.scrollLeft(singleWidth * visible);
                    // reset back to start position
                    page = 1;
                } 

                currentPage = page;
            });                

            return false;
        }

        $wrapper.after('<a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a>');

        // 5. Bind to the forward and back buttons
        $('a.back', this).click(function () {
            return gotoPage(currentPage - 1);                
        });

        $('a.forward', this).click(function () {
            return gotoPage(currentPage + 1);
        });

        // create a public interface to move to a specific page
        $(this).bind('goto', function (event, page) {
            gotoPage(page);
        });
    });  
};

$(document).ready(function () {
  $('.infiniteCarousel').infiniteCarousel();
});
</script>
</head>
<body>


        <div class="infiniteCarousel">
            <div class="wrapper">
                <ul>
                    <li><a href="images/pic1.png"><img src="images/pic1.png" /></a></li>
                    <li><a href="images/pic2.png"><img src="images/pic2.png" /></a></li>
                    <li><a href="images/pic3.png"><img src="images/pic3.png" /></a></li>
                    <li><a href="images/pic4.png"><img src="images/pic4.png" /></a></li>
                    <li><a href="images/pic5.png"><img src="images/pic5.png" /></a></li>
                    <li><a href="images/pic6.png"><img src="images/pic6.png" /></a></li>
                    <li><a href="images/pic7.png"><img src="images/pic7.png" /></a></li>
                    <li><a href="images/pic8.png"><img src="images/pic8.png" /></a></li>
                </ul>    
            </div>
        </div>



</body>
</html>

And this:

.infiniteCarousel{
position: relative;
float: right;
width: 501px;
margin: 193px 0 0 -2px;
z-index: 10000;
}
.infiniteCarousel .wrapper{
position: absolute;
top: 0;
min-height: 10em;
width: 395px;
margin: 0 40px;
overflow: auto;
}
.infiniteCarousel ul a img{border: none;}
.infiniteCarousel .wrapper ul{
position: absolute;
padding:0;
top: 0;
width: 9999px;
margin:0;
list-style-image:none; ist-style-position:outside; list-style-type:none;
}
.infiniteCarousel ul li{
display:block;
float:left;
padding: 10px 5px;
height: 124px;
width: 124px;
}
.infiniteCarousel ul li a img{display:block;}
.infiniteCarousel .arrow{
display: block;
height: 50px;
width: 50px;
background: url(../images/arrow.png) no-repeat 0 0;
text-indent: -999px;
position: absolute;
top: 33px;
cursor: pointer;
}
.infiniteCarousel .forward{background: url(../images/arrowright.png) no-repeat 0 0; right: 3px;}
.infiniteCarousel .back{background: url(../images/arrowleft.png) no-repeat 0 0; left: -12px;}
.infiniteCarousel .forward:hover{background: url(../images/arrowrighthover.png) no-repeat 0 0;}
.infiniteCarousel .back:hover{background: url(../images/arrowlefthover.png) no-repeat 0 0;}
  • 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-05-16T06:52:39+00:00Added an answer on May 16, 2026 at 6:52 am

    How about clearing after each third li:

        <div class="infiniteCarousel">
            <div class="wrapper">
                <ul>
                    <li><a href="images/pic1.png"><img src="images/pic1.png" /></a></li>
                    <li><a href="images/pic2.png"><img src="images/pic2.png" /></a></li>
                    <li><a href="images/pic3.png"><img src="images/pic3.png" /></a></li>
                    <br class="clear" />
                    <li><a href="images/pic4.png"><img src="images/pic4.png" /></a></li>
                    <li><a href="images/pic5.png"><img src="images/pic5.png" /></a></li>
                    <li><a href="images/pic6.png"><img src="images/pic6.png" /></a></li>
                    <br class="clear" />
                    <li><a href="images/pic7.png"><img src="images/pic7.png" /></a></li>
                    <li><a href="images/pic8.png"><img src="images/pic8.png" /></a></li>
                </ul>    
            </div>
        </div>
    

    Notice the addition of <br class="clear" /> above. The CSS for clear class is:

    .clear{
      clear:both;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I transform the following jQuery code to working JavaScript code? jQuery $('select
Can somebody give a good explanation of FFT image transform How the FFT transformed
How can I compact the jQuery Code Below? //FIRST CODE jQuery('.expand-two').click(function(){ jQuery('.content-two').slideToggle('fast'); }); jQuery('.expand-two').toggle(function()
on jQuery UI you can transform checkboxes or radio fields to buttons -> http://jqueryui.com/demos/button/#radio
I have a python as CGI and the POST from jquery will transform json
How can you specify cross-browser transform controls using jQuery since each browser seems to
I have a scene and an object placed in some coordinates. I can transform
In SQL server How can I transform 1 row with varchar columns into a
Can I get Visual Studio to transform the built-in aliases into the System types?
Can any of STL algorithms/container operations like std::fill , std::transform be executed in parallel

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.