Coder Social home page Coder Social logo

thiagoslweb / jquery-infinite-carousel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cmchurch/jquery-infinite-carousel

0.0 0.0 0.0 108 KB

This is an edit of jquery-infinite-carousel by Stephane Roucheray (https://code.google.com/p/jquery-infinite-carousel/) that allows for one to set the carousel to an initial slide

JavaScript 100.00%

jquery-infinite-carousel's Introduction

attribution

This is an edit of jquery-infinite-carousel by Stephane Roucheray (https://code.google.com/p/jquery-infinite-carousel/), which is licensed under GNU GPL v2.

Please see the initial documentation at https://code.google.com/p/jquery-infinite-carousel/ for how to impletement the carousel.

edits

The modifications allow for one to set the carousel to a particular slide upon its initialization.

The specific implementation of this modification was as follows: a variable was passed via the URL, and this variable was then used to intialize the carousel to a particular slide. This allowed a user to keep the particular slide he or she was on throughout his/her navigation of the carousel.

Therefore, the url "foo/bar?slide=X" would initialize the slideshow to slide X.

how to use

You can set the carousel to a particular initial slide using,

   jQuery('#viewport').carousel('#simplePrevious', '#simpleNext', initial_slide);

Or you can parse the URL ( "foo/bar?slide=X" ) using Regex,

  function parseURL (name) {
			name = RegExp ('[?&]' + name.replace (/([[\]])/, '\\$1') + '=([^&#]*)');
			return (window.location.href.match (name) || "0")[1];
		}

And then call the carousel.js using

	jQuery(document).ready(function(){
		     var initial_slide = parseInt(parseURL("slide"));
		     jQuery('#viewport').carousel('#simplePrevious', '#simpleNext', initial_slide);	
		});

jquery-infinite-carousel's People

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.