Git Product home page Git Product logo

lightshow.js's Introduction

LightShow.js

A lightweight slideshow for jQuery.

Live demo

Instalation

Just copy files from the source folder into your project. Images should be in the same folder as jquery.lightshow.css.

Then add these two lines into <head> section of your page.

<script src="js/jquery.lightshow.js"></script>
<link href="css/jquery.lightshow.css" rel="stylesheet">

Usage

Your slideshow has to have this structure.

<div class="my-slideshow">
	<ul>
		<li data-title="Example title 1">
			<img src="images/1.jpg" alt="">
		</li>
		<li data-title="Example title 2">
			<img src="images/2.jpg" alt="">
		</li>
	</ul>
</div>

There can be anything inside the <li>...</li>, not just a single image.

The only thing left to do is triggering the LightShow. This will run it with default settings.

$(document).ready(function() {
	$(".my-slideshow").lightshow();
});

Options

LightShow comes with several options. These are their default values.

$(document).ready(function() {
	$(".my-slideshow").lightshow({
		autoplay        : true,    // (boolean) animate automatically 
		pause           : true,    // (boolean) pause on hover 
		duration        : 3000,    // (integer) single slide duration, in milliseconds 
		animation       : 500,     // (integer) animation duration, in milliseconds
		transition      : "fade",  // (string)  transition between slides (fade, slide)
		controls        : true,    // (boolean) show controls 
		controls_always : false,   // (boolean) always show controls
		big_controls    : false,   // (boolean) big controls - half of an image
		circles         : true,    // (boolean) jumping between slides using little circles below LightShow
		title           : false,   // (boolean) show title from 'data-title' attribute of <li>
		title_always    : false,   // (boolean) always show title
		change_url      : false,   // (boolean) put current slide number into url
		keyboard        : false,   // (boolean) enables keyboard navigation - left and right arrow

		responsive      : false,   // (boolean) LightShow is responsive by default, but sometimes big controls aren't as big as they should be - this corrects them
		different_sizes : false,   // (boolean) set to true if your slides have different sizes (fixes transitions between them)

		after_autoplay  : function() {}, // callback function after slide is changed by autoplay
		after_next      : function() {}, // callback function after next button is clicked
		after_prev      : function() {} // callback function after prev button is clicked
	});
});

Troubleshooting

Responsive design

If your encounter problems with the size of LightShow on a responsive website, trigger it after page is fully loaded like this.

$(window).load(function() {
	$(".my-slideshow").lightshow();
});

Also, it may be necessary to set the responsive option to true when using big_controls.

lightshow.js's People

Contributors

kozakr avatar

Stargazers

 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.