Guest, register

Create Sliding Photo Gallery using jQuery Free photo gallery is one of the interesting features in the world of web.

This free HTML JavaScript tutorial don't guide you create a flash sliding gallery, but sliding image gallery; by using jQuery scrollable UI library.

Please go to the detailed post to get full instructions and JavaScript example codes for a beautiful web photo gallery on your website.

Free iPage Web Hosting for First Year NOW

If you're still looking for a reliable web host provider with affordable rates, why you don't take a little of time to try iPage, only with $1.89/month, included $500+ Free Extra Credits for the payment of 24 months ($45)?

Over 1,000,000+ existisng customers can not be wrong, definitely you're not, too! More important, when you register the web hosting at iPage through our link, we're going to be happy for resending a full refund to you. That's awesome! You should try iPage web hosting for FREE now! And contact us for anything you need to know about iPage.
Try iPage for FREE First Year NOW

Scrollable image slider  is one of the interesting features in the image gallery application. This allows us to display thumbnails in the form of slides that can be scrolled automatically or manually using the control buttons.

Figure below shows a scrollable image slider featuring four thumbnails per slide. To display thumbnails from another slide, simply by clicking the navigation buttons located on the right and left slide. Slides can also be scrolled automatically by using the  left and right arrow keyboard or using  the mouse wheel.

Scrollable image gallery

Scrollable image slider

In this tutorial, i'll use Scrollable component from jQuery Tools user interface (UI) library which is based on popular jQuery javascript framework. Current version of jQuery Tools at the time of this writing is version 1.1.2, which can be downloaded here. The library itself consists of six user interface components that can be easily combined:  Tabs, Tooltip, Overlay, Scrollable, Expose, and Flashembed.

How to Setup

  • Download Scrollable component from download page and save it as You can download it with jQuery (v1.3.2)  as a single file (21.75 kb) or as a separated file (3.37 kb) if you already have jQuery.
  • Include the in the HEAD section of your HTML file
  • 1<script src="scripts/" type="text/javascript"></script>


    1<script src="scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    2<script src="scripts/" type="text/javascript"></script>

Using Scrollable UI library


01<a class="prevPage left"></a>
02<div class="scrollable">
03    <div class="items">
04        <!-- 1-4 -->
10        <!-- 5-8 -->
16        <!-- 10-12 -->
21    </div>
24<a class="nextPage right"></a>

line 01:  element for left/prev  button.

line 02: root element (div) for the scrollable.

line 03: wrapper element.

line 04-20: scrollable images (will be displayed  four images per slide).

line 24: element for right/next button.

CSS Code


01.scrollable {
02    background: #ccc;
03    position: relative;
04    overflow: hidden;
05    width: 690px;
06    height:145px;
07    border:1px solid #ccc;
08    -moz-border-radius:4px;
09    -webkit-border-radius:4px;
12.scrollable .items {
13    width: 20000em;
14    position: absolute;
15    clear: both;
18.scrollable img {
19    opacity: 0.6;
20    float:left;
21    margin:15px 5px 15px 15px;
22    background-color:#fff;
23    cursor:pointer;
24    width:150px;
25    height:113px;
26    -moz-border-radius:4px;
27    -webkit-border-radius:4px;
30.scrollable .active {
31    opacity:1;
32    border:2px solid #000;
33    z-index:9999;
34    position:relative;

line 01, style for  container element, the length and width depends on image size and how many images you want displayed per slide.

line 12, style for wrapper element.

line 18,  style for images in a slide.

line 30, style for selected image.

Navigation button (prev & next)

01.scrollable { float:left; }
03a.left, a.right {
04    display: block;
05    width: 18px;
06    height: 18px;
07    float: left;
08    margin: 60px 10px;
09    cursor: pointer;
12a.right { background: url(scrollable/arrow/right.png) no-repeatclear:right; margin-right: 0px;}
13a.right:hover  { background-position:0px -18px; }
14a.right:active  { background-position:0px 0px; }
16a.left  { background: url(scrollable/arrow/left.png) no-repeatmargin-left: 0px; }
17a.left:hover  { background-position:0px -18px; }
18a.left:active  { background-position:-0px 0px; }
20a.disabled { visibility:hidden !important; }

line 01, allow next and  prev buttons placed on each side of the slide.

line 12,  set size and position of prev and next buttons.

line 16,  set background image for prev and next buttons.

Javascript Code

2    $(function()  { $("div.scrollable").scrollable({size: 4}); });

$("div.scrollable") is a jQuery selector for scrollabe container. On example above, we set four images for each slide using configuration parameter 'size'. Default value of 'size' parameter is 5. You can learn more about the API of the Scrollable component on this page.

View Live DemoDownload Example Source Code
Save up to 630$ when buy new iPhone 15
Free Airdrops to Claim, Share Up to $150,000 per Project
Open tool hub for free to use by any one for every one with hundreds of tools,,,
Talk to ChatGPT by your mother language
Generate creative images automatically with AI
Render creative video automatically with AI

JavaScript by day

Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web