Git Product home page Git Product logo

flickgal's Introduction

flickGal

flickGal

A light weight jQuery plugin to implement flick gallery for smart phone.

Features

Main features of this plugin are:

  • Light weight. (3.4k)
  • Designer friendry. (HTML based)

This plugin cannot do:

  • Vertical flick scroll (who ever wants?)
  • Auto scroll with timer. This will need a lot of options that I don't like.

Demo

Here is a quick demo.

http://stakam.net/jquery/flickgal/demo

Tested on iOS Safari and Android 4.0. PC browsers? Yeah. IE? Na.

Download

Right click on this link or you can just download this project.

How to use

Only 3 steps!

1. Build HTML like below.

<div class="yourElement"><!-- Main container -->

  <div class="container"><!-- Flickable element (required) -->
    <div class="containerInner"><!-- (required) -->
      <div id="sea01" class="item"><img alt="" src="images/sea/01.jpg" /></div><!-- must have `item' for class name -->
      <div id="sea02" class="item"><img alt="" src="images/sea/02.jpg" /></div>
      <div id="sea03" class="item"><img alt="" src="images/sea/03.jpg" /></div>
    </div>
  </div>

  <div class="nav"><!-- Tab, indicator or others (optional) -->
    <ul>
      <li class="sea01"><a href="#sea01"></a></li>
      <li class="sea02"><a href="#sea02"></a></li>
      <li class="sea03"><a href="#sea03"></a></li>
    </ul>
  </div>

  <div class="arrows"><!-- Next and prev element (optional) -->
    <span class="prev">Previous</span><!-- must have `prev' for className -->
    <span class="next">Next</span><!-- must have `next' for className -->
  </div>

</div>

2. Write CSS.

.yourElement .item { width: 200px } /* This is required if you have <img> element in .item element. */
.yourElement .moving {
  /* You can change transition-duration of course. */
  transition: transform .2s ease-out;
  -webkit-transition: -webkit-transform .2s ease-out;
  -moz-transition: -moz-transform .2s ease-out;
}

3. Include javascripts and run.

<script src="./javascripts/jquery-1.4.3.min.js"></script>
<script src="./javascripts/jquery.flickgal.js"></script>
<script>
$(function(){
  $(".yourElement").flickGal();
});
</script>

Available options

$(function(){
  $(".yourElement").flickGal({
    infinitCarousel : false,
    lockScroll      : true
  });
});
Options Default value Description
infinitCarousel false If true and you have prev/next elements, the last item slides to the first item and vise versa.
lockScroll true Lock horizontal scroll while sliding. If you have large images in .item element, you may want this fasle.

Advanced use

FlickGal provides 3 custom events.

$(function(){
  $(".yourElement").flickGal()
    .on('fg_flickstart', function (e, index) {
      // Emitted when a user start flicking.

    }).on('fg_flickend', function (e, index) {
      // Emitted when a user end flicking.

    }).on('fg_change', function (e, index) {
      // Emitted when displayed item will be changed.
    });
});

Lisence

Copyright (c) 2012 Soichi Takamura (http://stakam.net/)
Dual licensed under the MIT and GPL licenses:
 http://www.opensource.org/licenses/mit-license.php
 http://www.gnu.org/licenses/gpl.html

flickgal's People

Contributors

piglovesyou avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.