0.3.0 • Published 5 years ago

threesixty v0.3.0

Weekly downloads
56
License
MIT
Repository
github
Last release
5 years ago

Threesixty

Npm package version Travis Npm dependencies Npm total dowloads License

A minimal, dependency-free vanilla 360° slider.

Demo

Demo

Features

  • Super easy to set up
  • No dependencies
  • Touch events
  • Touch-enabled laptops support (touch + mouse)

Installation

npm install --save threesixty

Usage

threesixty(container*, images*, options?)

Initialise threesixty by passing both container and images required arguments.

container

The Element to display the slider in.

images

An Array containing a list of images.

var container = document.querySelector('#slider');
var images = [
  'images/sequence-01.jpg',
  ...
  'images/sequence-50.jpg'
]

var slider = threesixty(container, images);
slider.init()

Options

You can also provide an options object. Here's an overview of the default values.

threesixty(container, images, {
  interactive: true,
  currentImage: 0,
  reverse: false
});

options.interactive

Enable or disable mouse interactivity.

options.currentImage

Set the current image index.

options.reverse

Reverses the direction the image rotates when dragging.

API

MethodArgumentsMethod Description
initInitialise the slider
previousGo back to the previous frame
nextAdvance to the next frame
isInteractiveReturns options.interactive value
isReverseReturns options.reverse value
getCurrentFrameReturns options.currentFrame value

Tests

npm test

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

License

This project is licensed under the MIT License - see the LICENSE file for details.

0.3.0

5 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago