jQuery | Flipping Gallery Plugin

28 May, 2020
jQuery provides a simple, beautiful, and interactive flipping gallery plugin which helps programmers to flip many images in a gallery in various directions with the autoplay feature. The plugin is implemented by using HTML markups and simple javascript function call.
Please download the Flipping gallery plugin in your working folder and include all the relevant files in the head section of your landing web page.Download link: https://github.com/peachananr/flipping_gallery
Example 1: In the following program, the simple call of flipping_gallery() function is shown for basic usage. Previous and Next buttons are provided for handling of flipping images in forward or backward movements.
<!doctype html><html><head>    <meta charset="utf-8">    <title>jQuery Flipping Gallery Plugin </title>              <link href='http://fonts.googleapis.com/css?family=Open+Sans:300, 400, 700'           rel='stylesheet' type='text/css'>    <link href='http://fonts.googleapis.com/css?family=Noto+Serif:400,                      700, 400italic, 700italic'          rel='stylesheet' type='text/css'>    <link href='http://fonts.googleapis.com/css?family=Pacifico'                 rel='stylesheet'                type='text/css'>    <link href='flipping_gallery.css'           rel='stylesheet' type='text/css'>          <script type="text/javascript"             src="http://code.jquery.com/jquery-1.9.1.js">     </script>    <script type="text/javascript"             src="jquery.flipping_gallery.js">      </script>  <style>    html    {      height: 90%;    }    body    {      padding: 0;      text-align: center;      font-family: 'open sans';      position: relative;      margin: 0;      height: 80%;    }          .wrapper    {        height: auto !important;        height: 60%;        margin: 0 auto;         overflow: hidden;    }          a     {      text-decoration: none;    }                  .btn     {      display: inline-block;      border: 4px solid black;      border-radius: 4px;      -moz-border-radius: 4px;      -webkit-border-radius: 4px;      background: green;      display: inline-block;      line-height: 100%;      padding: 0.6em;      text-decoration: none;      color: #0d2633;      width: 100px;      line-height: 100%;      font-size: 14px;      font-family: open sans;      font-weight: bold;      border: none;      margin-left: 10px;    }            .btns {      width: 200px;      margin: 20px auto;          }             .page-container {      max-width: 700px;            margin: auto;      position: relative;    }            .gallery {      height: 300px;      width: 500px;           margin: 150px auto 100px;    }           img    {     border : 1px solid black;    }      </style>    <script>      $(document).ready( function() {        $(".gallery").flipping_gallery();                  $(".next").click(function() {          $(".gallery").flipForward();          return false;        });        $(".prev").click(function() {          $(".gallery").flipBackward();          return false;        });      });              </script></head><body>    <h3 style="color:green">           GeeksForGeeks - jQuery Flipping gallery     </h3>               <div class="wrapper">                  <div class="page-container">             <div class="gallery">          <a href="#" data-caption="">          <img src="images/geeksimage1.png" border="2"></a>          <a href="#" data-caption="">          <img src="images/geeksimage2.png" border="2"></a>          <a href="#" data-caption="">          <img src="images/geeksimage3.png" border="2"></a>          <a href="#" data-caption="">          <img src="images/gfg2.jpg" border="2"></a>          <a href="#" data-caption="">          <img src="images/gfg6.png" border="2"></a>                    <a href="#" data-caption="">          <img src="images/background.jpg" border="2"></a>          <a href="#" data-caption="">          <img src="images/background2.jpg" border="2"></a>          <a href="#" data-caption="">          <img src="images/background3.jpg" border="2"></a>                 </div>                <div class="navigation">          <a href="#" class="btn prev">Previous</a>          <a href="#" class="btn next">Next</a>        </div>      </div>       </div></body></html>
Output :
Example 2: In the following program, various options setting are implemented using javascript function call.The programmer can make use of various options depending on the application’s requirement. Please read the comments for each option values and use accordingly. Programmer can make use of data-caption attribute to add captions.
<!doctype html><html><head>    <meta charset="utf-8">    <title>jQuery Flipping Gallery Plugin </title>              <link href='http://fonts.googleapis.com/css?family=Open+Sans:300, 400, 700'           rel='stylesheet'          type='text/css'>    <link href='http://fonts.googleapis.com/css?family=Noto+Serif:400,                    700, 400italic, 700italic'          rel='stylesheet' type='text/css'>    <link href='http://fonts.googleapis.com/css?family=Pacifico'          rel='stylesheet' type='text/css'>    <link href='flipping_gallery.css'           rel='stylesheet' type='text/css'>          <script type="text/javascript"             src="http://code.jquery.com/jquery-1.9.1.js">    </script>    <script type="text/javascript" src="jquery.flipping_gallery.js">    </script>  <style>    html    {      height: 90%;    }    body    {      padding: 0;      text-align: center;      font-family: 'open sans';      position: relative;      margin: 0;      height: 80%;    }          .wrapper    {        height: auto !important;        height: 60%;        margin: 0 auto;         overflow: hidden;    }          a     {      text-decoration: none;    }                  .btn     {      display: inline-block;      border: 4px solid black;      border-radius: 4px;      -moz-border-radius: 4px;      -webkit-border-radius: 4px;      background: green;      display: inline-block;      line-height: 100%;      padding: 0.6em;      text-decoration: none;      color: #0d2633;      width: 100px;      line-height: 100%;      font-size: 14px;      font-family: open sans;      font-weight: bold;      border: none;      margin-left: 10px;    }            .btns {      width: 200px;      margin: 20px auto;          }             .page-container {      max-width: 700px;            margin: auto;      position: relative;    }            .gallery {      height: 310px;      width: 500px;           margin: 150px auto 100px;    }           img    {     border : 1px solid black;    }     .navigation {      margin-bottom: 150px;    }    </style>    <script>      $(document).ready( function() {        $(".gallery").flipping_gallery({/* The options for the flipping direction are "forward", or "backward". Default value is forward.*/           direction: "forward",   // Default selector is set for generation of the gallery.           selector: "> a",   /* Spacing between each photo in pixels in the gallery.     Default value is 10.*/           spacing: 20,   // Limit the number of photos in the viewport.           showMaximum: 5,   // Set the scrolling behavior. Default value is true.           enableScroll: true,   /* Direction to flip picture. Options are "left", "right", "top", "bottom". Default value is bottom.*/           flipDirection: "left",   // Autoplay time interval. Default value is false.           autoplay: 1200         });                  $(".next").click(function() {          $(".gallery").flipForward();          return false;        });        $(".prev").click(function() {          $(".gallery").flipBackward();          return false;        });      });              </script></head><body>    <h3 style="color:green">           GeeksForGeeks - jQuery Flipping gallery     </h3>               <div class="wrapper">                  <div class="page-container">             <div class="gallery">          <a href="#" data-caption="GeeksForGeeks Logo">          <img  src="images/geeksimage1.png" border="2"></a>            <a href="#" data-caption="Learning computer science!">          <img  src="images/geeksimage2.png" border="2"></a>            <a href="#" data-caption="jQuery is fun.">          <img src="images/geeksimage3.png" border="2"></a>            <a href="#" data-caption="Geeks week contest">          <img src="images/gfg2.jpg" border="2"></a>            <a href="#" data-caption="WebTechnology classes">          <img src="images/gfg6.png" border="2"></a>            <a href="#" data-caption="Going thr links and hyperlinks">          <img src="images/background.jpg" border="2"></a>            <a href="#" data-caption="HTML fundamentals">          <img src="images/background2.jpg" border="2"></a>            <a href="#" data-caption="CSS tutorials">          <img src="images/background3.jpg" border="2"></a>                 </div>                <div class="navigation">          <a href="#" class="btn prev">Previous</a>          <a href="#" class="btn next">Next</a>        </div>      </div>  </div></body></html>
Output:
In the following script, the option setting for flipping in top direction is shown. The programmers can similarly make use of other options as well for different flipping options.
$(document).ready( function() {    $(".gallery").flipping_gallery({         flipDirection: "top",         autoplay: false    });});
Output:
jQuery-Plugin
JQuery
Web Technologies
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Form validation using jQuery
jQuery | children() with Examples
Scroll to the top of the page using JavaScript/jQuery
How to Dynamically Add/Remove Table Rows using jQuery ?
How to get the value in an input text box using jQuery ?
Top 10 Projects For Beginners To Practice HTML and CSS Skills
Installation of Node.js on Linux
Difference between var, let and const keywords in JavaScript
How to insert spaces/tabs in text using HTML/CSS?
How to fetch data from an API in ReactJS ?