Hi all! Today we will talk about perhaps the best free photo gallery, video and photo slider, let's talk about “photo frame”. Despite the fact that the script has not been supported for 2 years and the author switched to a project on a similar topic, it works great and continues to please the eye.

Main advantages (+)

  • Easy to install, configure and use. Besides jQuery, you will need connect only 2 files, and to display the gallery you only need to provide links to the pictures.
  • Slightly affects site loading speed.
  • Adaptability. Your gallery looks good on a phone, a laptop, and even a TV screen.
  • An abundance of settings and functions that can be connected separately through the attributes of HTML tags.
  • Support for touch devices.
  • Video support.
  • Possibility of lazy loading of images.
  • And many, many other things that will appeal to a sophisticated user.
  • Minuses (-)

  • Lack of user support. The likelihood that your problem will be addressed or corrected is almost zero. Yes, this is bad, but not fatal.
  • First option for connecting Fotorama

    This connection option is the simplest, but not the best; it should be used only if you need to display the gallery on most pages of the site. The advantage of this option is the use of CDN.

  • Checking for jQuery. Go to source site (combination Ctrl keys+ U) → we are trying to find something like this line: https://ajax.googleapis.com/ajax/libs/jquery/X.X.X/jquery.min.js

    To make your search easier, use Ctrl + F . If the coveted line is not there, then you will have to connect jQuery. On WordPress, this can be done by pasting the code below into the theme's functions file (functions.php). In fact, this script is used for conflicts different versions jQuery and it operates according to the following scheme: it deletes the previously registered jQuery, registers a new one, and displays the script. Current versions jQuery libraries can be found here.

    You can simply insert this line between and :

  • We connect fotorama.css and fotorama.js. Insert the following code between the and tags, in WordPress this is done in the theme header file (header.php).
  • This completes connecting the gallery using the first method. How to use it is written in the section “Directly creating a gallery”.
  • Second connection option [shortcode + Autoptimize]

    In this connection option, script files will be displayed only on the necessary pages via [shortcode]. And if you use the Autoptimize plugin, then the script code will also be integrated into the theme files. These simple manipulations should increase the site loading speed.

  • Checking for jQuery. Just like in the first option, see above.
  • Download the photo frame files → unpack → upload to a separate folder in the root of the site.
  • To create a shortcode, insert the code below into the theme functions file (functions.php), change the links to the files to your own..js"> "; ) add_shortcode("foto","sd");
  • Now, when writing an article, enter the shortcode at the end
  • Directly creating a gallery

    The gallery is displayed in HTML code using container c class="fotorama", the container contains the image output code or link to image . When writing an article using the WordPress engine, switch the editor to text mode and enter the container c class="fotorama" .

    It looks like this:

    Or like this (numbering of links is optional):

    1 3 4

    Examples of Fotorama settings Container dimensions

    The size of the photo frame block is the size of the first image, other images are scaled in proportion to the first. To correct this situation, you can specify the dimensions manually.

    There are other settings:

    Data-width="98%" //relative width data-ratio="800/600" //aspect ratio data-minwidth="420" //min. width data-maxwidth="900" // max. width data-minheight="320" // min. height data-maxheight="100% // relative max height data-height="100% // relative height

    Miniatures

    Data-nav="thumbs" is responsible for thumbnails

    But this method is not very effective, since the script has to load all the photos at once to generate thumbnails, so it would be more rational to prepare small copies of the pictures in advance. WordPress automatically creates thumbnails, which is what we will use. To get a link to the thumbnail, add -70x70 to the file name (https://site/wp-content/uploads/2017/11/27ltl9eRXk.jpg → https://site/wp-content/uploads/2017/11/27ltl9eRXk- 70x70.jpg).

    By default, the thumbnail is 64 × 64. You can adjust this parameter using data-thumbwidth (width) and data-thumbheight (height). If you need the thumbnail to have its own size, then set the width and height parameters for the thumbnail file:

    HTML code + Fotorama

    Photoframe perfectly processes HTML and CSS, which significantly expands the functionality of the script. Work with links, blocks, tables, paragraphs, write CSS and much more. Below are some examples of the gallery's work. If the visual part is not displayed, then click the "Result" button.

    Show/Hide Examples

    See the Pen ooppwb by Ivanov Klim (@DreamerKlim) on CodePen.

    See the Pen aVEEVb by Ivanov Klim (@DreamerKlim) on CodePen.

    Full screen mode data-allowfullscreen="true" //in the browser window data-allowfullscreen="native" //on the entire monitor

    It is possible to add a separate large image for full screen mode via data-full:

    Other data-autoplay ="true" //autoplay data-autoplay="3000" //interval between slides in ms data-caption ="One" //comments on pictures data-keyboard ="true" //arrow navigation data-shuffle ="true" //images in different order data-navposition ="top" //thumbnails at the top data-loop ="true" //cyclic scrolling Let's try to connect everything and add a video "some comment 1" > "some comment 2" > To find work you love

    Hello everyone!
    Developers of all stripes, when creating their next web project, are often interested in the question of how to present their users with various types of images, be they photographs or sets of pictures. For this, the inquisitive minds of the online space, for the most part of course this is a “bourgeois” space, are looking for more and more new solutions to create spectacular, colorful, and most importantly functional slide shows and photo galleries. For the most part, they are customized by developers to fit the design of the template of the web project being created, or in the form of plugins and modules for a specific site management engine. It’s worth looking at modern templates for, not a single theme, with rare exceptions, can do without some kind of plug-in slider or simple image rotator. So it’s understandable that many web developers want to have something like this in their arsenal and surprise their readers to the fullest by effectively presenting images on their sites.

    Continuing the ongoing series of reviews of emerging new solutions when creating, I decided to put together a more complete collection of the most interesting and effective slideshows and photo galleries I have ever encountered, created using the magic of jQuery.
    I would like to warn you right away that the resources discussed in the review are mainly in English, but I think whoever needs it will figure it out intuitively or with the help of translators, of whom there are a dime a dozen. And if you search hard enough, you can find descriptions of the technique for creating some galleries and sliders in Russian, since many of our web developers translate while working on a particular project, first for themselves, and then post detailed descriptions of all their manipulations for free access .
    For example, this is what I did, when I was working on the mechanism for creating , I first found a gallery option that was suitable for me in the burzhunet, translated it for a better understanding of what I was doing, and in the future it turned out, I hope, not a bad article about using the Highslide script, with examples of work in various application variations.
    And so, enough of the unnecessary lyrics, let's move on directly to the review, watch, read brief explanations and choose from a huge number of new jQuery plugins and scripts for implementing interesting image sliders, photo galleries, slide shows on your sites: with automatic and manual change sliders, background image sliders, with and without thumbnails, etc. and so on...

    Of.Site | Demo

    A complete, customizable jQuery image gallery with slideshow elements, transition effects, and multiple album options. Compatible with all modern desktop and mobile browsers.

    A tutorial on how to create a full screen gallery using jQuery. The idea is for a thumbnail of the featured full-screen image to appear to the side, with a reflection as you move through the images using the arrows or mouse click. Large images move up or down in a slideshow style depending on the transition you choose. The ability to scale the image, which makes the image in the background viewable in full screen mode or adjusted to the page size.

    Parallax Slider

    Parallax Slider is an interesting solution for organizing the display of images in the form of a slide show with manual control elements. The original placement of thumbnail pictures attracts attention. The official website has a complete breakdown of how to integrate and configure the slider.

    Minimalistic Slideshow Gallery with jQuery is an excellent image gallery with elements for automatically changing pictures, as well as the ability to manually control display and select images from a drop-down block with a grid of thumbnails. One of the disadvantages is the lack of viewing full-size images, but this is the minimalism of this gallery.

    This is a full-screen slideshow with automatically changing images, no mind-blowing effects, everything is simple and tasteful.

    Minimit Gallery is a highly customizable jQuery plugin, with a large selection of transitions when displaying images. Using Minimit gallery, you can organize a display of images in the form of a carousel, slide show, a simple rotator, and a regular picture scroller.

    is a tiny (2kb) jQuery plugin that provides a simple, no-nonsense way to display images as a slideshow.

    is a nice looking javascript gallery, with intuitive controls and seamless compatibility on all computers, iPhones and mobile devices. Very easy to install and configure

    Unlike many Javascript and jQuery image sliders, Slider.js is a hybrid solution, powered by CSS3 transitions and animations.

    This is a one-page template for creating various presentations in HTML5 and CSS3.

    Diapo slideshow is an open source project. If you want, you can suggest changes or improvements. You can download and use it for free, and nothing and no one is stopping you from using this slider in your projects. The slider is easy to customize, there are interesting transitions between the presented content, and you can place anything in the slider, it works quite quickly, without any jambs.

    is nothing more than another tool for creating slideshows on websites and other web projects. Supports all modern browsers, horizontal and vertical animations, support for custom transitions, callback API and much more. You can use any HTML elements in your slides, it is understandable and accessible for beginners, and is distributed completely free of charge.

    JavaScript Slideshow for Agile Development

    Implement your slideshows with this awesome jQuery plugin. Highly customizable tool so you can build your content presentation according to your requirements. To provide easier integration with external data or data from your CMS, the . This is a new version and written from scratch. The developers tried to describe the entire process of working with their brainchild very clearly and intelligibly.

    is a jQuery plugin that allows you to transform unordered lists into slideshows with attractive animation effects. In a slide show, you can display a list of slides, either using numbers or thumbnails, or using the Previous and Next buttons. The slider has many original animation types, including cube (with various sub-types), pipe, block and more.

    A complete set of tools for organizing all kinds of presentations of various content on your web projects. The bourgeois guys did their best, including almost all types of various sliders and galleries using the magic of jQuery. Photo slider, photo gallery, dynamic slide show, carousel, content slider, tabs menu and much more, in general there is room for our irrepressible imagination to run wild.

    This is a jQuery slideshow plugin that is built with simplicity in mind. Only the most useful set of functions is packed, both for beginners and advanced developers, providing the opportunity to create simple, but at the same time very effective slideshows that are user-friendly.

    — a simple slider built on jQuery, simple in all respects, not requiring special skills, I think many will find it useful for implementing slide shows on their websites. The plugin was tested in all modern browsers, including the slow IE browser.

    jbgallery is a kind of user interface widget written in javascript of the jQuery library. Its function is to show one large image as the background of the site in full-screen mode, several images in the form of a slider. All viewing modes have viewing controls. It’s an interesting solution in its own way, and in some cases it’s not even standard.

    It is an easy-to-use jQuery plugin for displaying your photos as a slideshow with transition effects between images (you've seen more interesting ones). jqFancyTransitions is compatible and extensively tested with Safari 2+, Internet Explorer 6+, Firefox 2+, Google Chrome 3+, Opera 9+.

    is a freely distributed jQuery plugin for viewing images and other information in the Lightbox form. Popup window with controls, shaded background and all that, simple and tasteful.

    Another jQuery plugin from the Lightbox series, although it weighs outrageously little (9 KB), but has a ton of functionality. There is a decently designed interface that you can always improve or customize using CSS.

    Already from the name it becomes clear that there is nothing fancy, we have a very simple automatic image scroller, with completely missing controls. Who knows, maybe this slider will attract your attention precisely with its minimalism.

    Image rotator with different types of transitions. It works both automatically and by clicking, and is quite easy to set up.

    — a full-fledged image gallery rather than just a slider. Preview of thumbnails and the ability to select transition effects, full support for all browsers, detailed description of integration into a web project and free distribution.

    This is an implementation of ready-to-use slideshows using scriptaculous/prototype or jQuery. Horinaja is somewhat of an innovative solution because it allows you to use a wheel to scroll through the content placed in the slider. When the mouse pointer is outside the slideshow area, scrolling occurs automatically; when the pointer is placed over the slideshow, scrolling stops.

    This is a feature from a series of simple image scrollers, albeit with viewing controls, and therefore works in both automatic and manual modes.

    s3Slider is a jQuery plugin that creates a slideshow from an unordered list of images and can be easily implemented on any web platform.

    This is a jQuery plugin that is optimized for processing large volumes of photos while saving bandwidth.

    Vegas Background

    Vegas Background jQuery plugin allows you to add beautiful full-screen background images to web pages, all with slideshow elements. If you carefully study the intricacies of working with the plugin, you can find many interesting solutions, of course, only if you need it.

    — a slider as a slider, no more, no less, with captions for images or announcements of articles and simple controls, at random.

    is a lightweight (about 5 KB) javascript for organizing image viewing. Automatic resizing and scaling of large images allows you to view the picture in full size within the browser window

    Version 4 of PikaChoose jQuery Image Gallery is available! Pikachoose is a lightweight jQuery slideshow with great features! Integration with Fancybox, excellent themes (though not free) and much more are offered to your attention by the plugin developers.

    Checks the number of images in your listing and dynamically creates a set of photo links as digital navigation. In addition, clicking on each image will move forward or backward, and you can also scroll through the images depending on the area you click on the picture (for example: clicking on the left side of the picture will move the slides back and forth, respectively, for the right side of the image).

    Another jQuery slider that will fit perfectly into any WordPress template.

    Another development of “Nivo”, like everything the guys from this studio do, the plugin is made with high quality, contains 16 unique transition effects, keyboard navigation and much more. This version includes a dedicated plugin directly for WordPress. So for all fans of this blogging engine, Nivo Slider will be just right for you.

    jQuery plugin that allows you to quickly create a simple, effective and beautiful slider for images of any size.

    Pirobox is a lightweight jQuery “lightbox” script, viewing is carried out in a pop-up block that automatically adjusts to the image size, with all controls.

    The creators of this gallery offer a rather original presentation of the pictures. The images are displayed in miniatures in the form of a wave, when you click on the thumbnail, we will see a medium-sized version of the image, click a second time and you will see a large image. You can consider this an experiment, but you must admit that something new and unusual is always interesting.

    Fullscreen slideshow with HTML5 and jQuery

    To create slideshows and display pictures in full screen mode, the developers used the already familiar Vegas jQuery plugin, which contains many ideas and techniques previously described in detail in the group’s articles. The presence of HTML5 audio elements and the style of transitions between images are attractive.

    Another development from the Codrops team, a full-fledged and functional image gallery, but there’s no point in describing it, you have to see it.

    Image slideshow, pictures disappear right before your eyes, the effect is simply wonderful.

    Is a JavaScript image gallery framework built on top of the jQuery library. The goal is to simplify the process of developing a professional image gallery for web and mobile devices. You can view it in a pop-up window or in full screen mode.

    We are quietly starting to get used to it and wait for new works from the Codrops team. Please get an excellent image slider with a magnificent 3D transition effect to view images in full screen mode.

    Another WordPress plugin from the slideshow organizer series. Easily integrates into almost any design and offers many customization options for experienced users and non-experienced ones too.

    Another plugin written for WordPress, it will make it much easier to organize a slideshow of pictures or any other content on your blogs.

    A good slideshow plugin for integration into WordPress. Xili-floom-slideshow is installed automatically, and personal settings are also allowed.

    Slimbox2 is a well-established WordPress plugin for displaying images with a Lightbox effect. Supports automatic slideshow and resizing of images in the browser window. And in general, this plugin has many advantages over other plugins in this series.

    This plugin/widget allows you to create dynamic, controlled slideshows and presentations for your website or blog running on the WordPress engine.

    This WordPress plugin transforms embedded gallery images into a simple and flexible slideshow. The plugin uses FlexSlider jQuery image slider and user personal settings.

    is a WordPress plugin for organizing slideshows of photos, pictures from SmugMug, Flickr, MobileMe, Picasa or Photobucket RSS feed, works and displays using pure Javascript.

    A simple slider for WordPress and more. Nothing superfluous or cumbersome, the work is done in a minimalist style, the emphasis is on stability and speed, it connects perfectly to the blog management engine.

    In my opinion, Skitter is one of the best sliders that supports working with WordPress. I am attracted by the stability and speed of operation, not too prominent controls, transition effects and a fairly simple connection to the theme.

    is a plugin for WordPress with which you can easily and quickly organize an image gallery on your website with the ability to view it in slide show mode. The display can be either automatic or fully controlled with demonstration of thumbnails and captions for images.

    Of.Site | Demo

    Shows all pictures for a post/page as a slideshow. Easy installation. This plugin requires Adobe Flash for the version with transition animations, if Flash is not found the slider works as usual.

    Another simple slider for WordPress, it shows images for posts and short announcements of articles. I use just such a plugin on this blog from time to time.

    Meteor Slides is a jQuery WordPress slider with over twenty transition styles to choose from. The author called the plugin a “meteor”, probably implying the speed of operation; perhaps I didn’t notice anything meteoric.

    oQey Gallery is a full-fledged image gallery with slideshow elements for WordPress, with built-in video and music capabilities.

    It is a slideshow with flash animation elements for viewing images and videos on websites and blogs. You can place this slider on any website, in any size and with any content you like.

    Flash Gallery plugin turns your regular galleries into stunning image walls, with support for multiple albums per post, full screen viewing and slideshow mode.

    WOW Slider is a jQuery image slider for WordPress with amazing visual effects (Explosion, Fly, Blinds, Squares, Fragments, Basic, Fade, Stack, Vertical Stack and Linear) and professionally designed templates.

    Promotion Slider is a jQuery plugin that makes it easy to create a simple slideshow, or implement multiple zones of rotating ads on a page, because it is a highly customizable tool, you will have full control over what you show in the slider and over how the module works generally.

    | Demo

    New in version 2.4: support for drag-n-drop photo sorting directly through the WordPress editor, as well as the ability to add photo links to main images. (IE8 may have some bugs, works fine in all major browsers. The authors promise full support for IE8 in the future.)

    | Demo

    The final chord of this review will be this plugin for WordPress, another slider with interesting visual effects for selecting and changing images.

    I look at everything described above and am amazed, what a flight of fancy these people have, but this is not all that various web developers have come up with lately on the topic of organizing images on web projects. It's great that it is now possible to implement such wonderful solutions for creating galleries and slide shows.
    I dare to quietly hope that in this collection you will find something interesting for yourself, create your own unique gallery or slider, to the delight of your users and, of course, your beloved self, and where would we be without this...

    In our collection of scripts you can find small but very useful and functional plugins for your website. Using jQuery Gallery, it's easy to create a beautifully designed digital photo gallery with scrolling, zooming, thumbnail viewing, and many other useful features. There are both strict solutions for professional websites, and bright ones with animation and other special effects for entertainment projects.

    With jQuery, images can be viewed without reloading the page or increasing traffic flow. The presented plugins allow you to optimize the loading of images in real time and present the gallery in a convenient and user-friendly way. With ease of customization and a variety of available solutions, your own jQuery photo gallery can now look exactly the way you want. The presented scripts have been tested on different platforms and have excellent compatibility.

    Today, responsive design has become the number one choice for designers and developers, as more and more people want their websites to run on smart devices. Responsive design draws mobile user’s attention and helps you to generate leads and sales which take your business to another level.

    Nowadays, you can create responsive layout for almost everything such as menu, grid, column and even pictures and images. If you want to display your website content, images and videos in a responsive gallery style then the following jQuery Image gallery plugins might help you out with it.

    This article includes some of the Best Responsive jQuery Image Gallery plugins which will not only enable you to create responsive image galleries for your websites but also display them in elegant styles to make your website more beautiful and visually stunning.

    Below is the list of Best Responsive jQuery Image Gallery Plugins worth considering in 2016.

    Bootstrap Photo Gallery is a simple jQuery plugin that will create a Bootstrap based responsive Photo Gallery for your images.
    This plugin supports variable height for the images and captions. An optional “modal” box with “next” and “previous” paging is also included.
    Demo & Download

    2. JK Responsive YouTube and Image Gallery


    It is a modern, lightbox style gallery for displaying images and YouTube videos on your site. The gallery interface is fully responsive and works beautifully across all devices big or small.
    Demo & Download

    3. Faba


    FABA is responsive Facebook albums and photos gallery jquery plugin that will load all the albums and photos from selected Facebook Page.

    There are around 90 options you can edit and you can customize almost everything: animations, hover effects, every part of hover animations, text’s, behaviors, and many more. You can integrate beautiful albums into your project, or web page.


    xGallerify is a lightweight, responsive gallery plugin which allows you to create beautiful image galleries for your websites. This plugin is lightweight (3kb of file size) , easy to use and comes with number of customizable options and styles.
    Demo & Download


    Instagram Element is a premium Instagram plugin for bloggers, photographers, models, and anyone looking to increase their presence on Instagram.
    This plugin is fully responsive and allows you to easily manage 50+ options and lets you display your photos beautifully on any device.


    SnapGallery is a simple jQuery plugin that turns an ugly list of differently sized images into a beautiful, customizable gallery with one line of JavaScript.

    It’s completely responsive, customizable and allows you to select the spacing between images, the minimum width allowed before stacking and the maximum number of columns, with more options on the way!
    Demo & Download


    Eagle Gallery this is modern gallery with image zoom functionality. To manage the gallery you can use gestures or control buttons. This is a fully responsive gallery which has support touch screen and was created for mobile devices, laptops and desktops.

    With this gallery you can easily create a product gallery on your internet shop for detailed view and customize it with help of options.


    The Unite Gallery is multipurpose JavaScript gallery based on jQuery library. It’s built with a modular technique with a lot of emphasis of ease of use and customization. It’s very easy to customize the gallery, changing its skin via css, and even writing your own theme. Yet this gallery is very powerful, fast and has the most of nowadays must have features like responsiveness, touch enabled and even zoom feature, it’s unique effect.
    Demo & Download


    jQuery lightGallery is a lightweight jQuery lightbox gallery for displaying image and video gallery.

    Lightgallery supports touch and swipe navigation on touchscreen devices, as well as mouse drag for desktops. This allows users to navigate between slides by either swipe or mouse drag.

    Lightgallery comes with a numerous number of options, which allow you to customize the plugin very easily. You can easily customize the look and feel of the gallery by updating SASS variables.
    Demo & Download


    This is another great jQuery image gallery plugin which allows you to create grid layout gallery for your pictures and videos. This plugins is fully responsive and bundled with number of features like social sharing, infinite scrolling, css3 animations, filters and much more.


    blueimp Gallery is a touch-enabled, responsive and customizable image & video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.

    It features swipe, mouse and keyboard navigation, transition effects, slideshow functionality, fullscreen support and on-demand content loading and can be extended to display additional content types.
    Demo & Download


    nanoGALLERY is a touch enabled and responsive image gallery with justified, cascading and grid layout. It supports self hosted images and pulling in Flickr, Picasa, Google+ and SmugMug photo albums.

    Featuring multi-level navigation in albums, combinable hover effects on thumbnails, responsive thumbnail sizes, multiple layouts, slideshow, fullscreen, pagination, image lazy loading and much more.
    Demo & Download


    flipGallery is a free jQuery powered photo gallery with sleek flipping transitions between thumbnails and lightbox enlargements. Other features include dynamic image streaming, auto pagination, auto cropping and transparent image overlay.

    This plugin also has a premium version which comes with few nifty features and certainly includes responsiveness.
    Demo & Download


    Fancy Gallery is responsive jQuery image gallery plugin which allows you to display your images and videos in fancy style. This plugins has lots of customization options and you can add unlimited albums, videos, pictures and much more.

    The plugin comes with different hover effects for the thumbnails and titles, which can also be adjusted. You can choose between 7 predefined color themes or just create your own color theme easily.


    Balanced Gallery is a jQuery plugin that evenly distributes photos across rows or columns, making the most of the space provided. Photos are scaled based on the size of the ‘container’ element by default, making Balanced Gallery a good choice for responsive websites.
    Demo & Download

    16. S Gallery


    S Gallery makes use of HTML5’s Full Screen API, and relies heavily on CSS3 animations goodness and CSS3 transforms, so it will work only in browsers that support these features.
    Demo & Download

    17. Ultimate Grid Responsive Gallery


    This is a HTML | CSS | JQuery Grid with a Lightbox, you can specify thumbnails for the grid and when you click on it to open the lightbox it will load the normal image, you can specify the text for the captions and for the lightbox. Also you don’t have to load all the images at once (for performance purposes) so you can specify the number of images to load when it first loads and the number of images to load when you click the “load more images” button.


    Responsive Thumbnail Gallery is a jQuery plugin for creating image galleries that scale to fit their container.
    Demo & Download


    SuperBox is a jQuery plugin that takes the whole ‘image’ and ‘lightbox’ one step further, reducing the JavaScript and image load dependence to make lightboxing a thing of the past! Using HTML5 data-* attributes, responsive layouts and jQuery.

    SuperBox works wonders as a static image gallery, which you can click to reveal a full version of the image.
    Demo & Download


    The Ultimate Thumbnail gallery is fully responsive image gallery plugin comes in two layout types (grid and line, vertical and horizontal), with scroll (jScrollPane) or button navigation. Thumbnail boxes support any HTML element inside them.

    In this lesson I will show you how to create a minimalistic, but at the same time convenient and functional photo gallery using jQuery, or an image gallery, as you wish. The gallery has the ability to create categories, followed by filtering. It is also possible to launch a slide show. The gallery works in all browsers, so there will be no problems with adaptation.

    To create this gallery, we will use two free jQuery libraries: Quicksand and PrettyPhoto. They make creating a gallery much easier. As always, you can see the result of the work on the demo page, and also download the archive from the working gallery and all the source files. The only drawback, so to speak, is the manual creation of thumbnails for large images. In all other respects, this gallery is worthy of attention.

    SOURCES

    HTML markup

    First, let's look at the panel with a list of categories, this is a bulleted list ul. Moreover, each list element must have a unique class name.


    • Categories:

    • All

    • Category 1

    • Category 2

    • Category 3

    • Category 4







  • Name of the picture


  • As mentioned above, list items are images in the gallery. Each list element includes components. This is the image itself, or rather its miniature, as well as a description. The thumbnail is a link to the main image. The rel attribute is needed to call javascript and open the main image.

    Don’t forget also about 2 important things: the li list element must have a unique data-id attribute. The data-type attribute contains the category class, the list of which I described above. Everything seems to be about markup.

    CSS Styles

    I won’t particularly focus on styles, since we use the ready-made PrettyPhoto library, which is responsible for enlarging the image, and css code enough. However, it is worth noting that there are 5 options for designing an enlarged image, although ideally only 3, since in two options only the rounding is removed.

    Therefore, I will only show CSS styles for thumbnails and the list of categories.

    Portfolio-categ ( margin-bottom:30px; )
    .portfolio-categli (
    display:inline;
    margin-right:10px;
    }
    .image-block(
    display:block;
    position: relative;
    }
    .image-block img (
    border: 1px solid #d5d5d5;
    border-radius: 4px 4px 4px 4px;
    background:#FFFFFF;
    padding:10px;
    }
    .image-block img:hover (
    border: 1px solid #A9CF54;
    box-shadow:0 0 5px #A9CF54;
    }
    .portfolio-area li (
    float: left;
    margin: 0 12px 20px 0;
    overflow: hidden;
    width: 245px;
    padding:5px;
    }
    .home-portfolio-text ( margin-top:10px; )
    li.active a ( text-decoration:underline; )

    In principle, everything should be clear with styles. To make the categories line up, the display property is set to inline . To give the effect of outlining an image, set background color(white) and a padding of 10 pixels. List item sizes are set in .portfolio-area li .

    jQuery

    And finally, the most important thing is what the whole lesson is for. This is jQuery code. Let's start by filtering the pictures by category.

    // Select all child elements of portfolio-area and write to a variable
    var $data = $(".portfolio-area").clone();

    $(".portfolio-categ li").click(function(e) (
    $(".filter li").removeClass("active");

    Var filterClass=$(this).attr("class").split(" ").slice(-1);

    If (filterClass == "all") (
    var $filteredData = $data.find(".portfolio-item2");
    ) else (
    var $filteredData = $data.find(".portfolio-item2");
    }
    $(".portfolio-area").quicksand($filteredData, (
    duration: 600,
    adjustHeight: "auto"
    ), function () (

    LightboxPhoto();
    });
    $(this).addClass("active");
    return false;
    });

    Using the clone() method and a selector, we select all child elements of .portfolio-area and write them to the $data variable. Next, we track the click on one of the categories, the li element of the list with the class .portfolio-categ . We make all categories inactive by removing removeClass(“active”), if this is not done, then over time all categories will be active and filtering will stop.

    Since we click on a list element, the this selector contains a list element, that is, li , from it we take the value of the class attribute and using the split method we split the class name into several parts, the border is a space (i.e. if the class was " all active" then after splitting we get an array of "all" and "active"). And then using the slice method, we select the first element of the array (in our case, “all”), and write the resulting result to the filterClass variable. If there is no space, the class name will not change.

    Next, we check if the filterClass variable contains the string all , then using the .find method we select all elements with the portfolio-item2 class from the $data array, which we looked at above. The selected elements (and these are all elements of the list, that is, all the pictures) are placed in the filteredData variable.

    Otherwise, if filterClass is not equal to all , then we will place not all elements of the list in the filterData variable, but only those whose data-type attribute matches the category class. In short, elements of only one category.

    And ultimately, we pass the resulting variable to the jquery quicksand library, which filters the images. That's it for filtering.

    Now, as for enlarging the image in the pop-up window. Everything is much simpler here.

    JQuery("a").prettyPhoto((
    animationSpeed: "fast",
    slideshow: 5000,
    theme: "facebook",
    show_title: false,
    overlay_gallery: false
    });

    A click on a link whose rel attribute begins with prettyPhoto is tracked. Then the prettyPhoto library comes into play and the image is miraculously enlarged. By the way, we are also passing several parameters. Such as the animation speed is fast, the slide show delay is 5 seconds, the Facebook design theme (there are 5 themes in total, they are located in the images/prettyPhoto folder), and we also prohibit showing the name of the picture and enlarging the picture when hovering the mouse.