jQuery plugin to display a 360 degree panoramic image
This plugin has been tested against jQuery 3.4.1. It should support other versions but they have not been tested.
img
- The URL to the background image. This should be a 360 degree panoramic image. You should set the CSS so that the width and height of the containing block are your desired size.interval
- How often to trigger the move command when the user holds down the mouse button, touch or if you call themoveLeft
ormoveRight
API methods. (Default 100ms)speed
- How fast should the animation move? (Default 50ms)
It will add a class of .moving
whenever the background image is being moved (whether drag & drop or via the controls).
The plugin returns a public API with 3 methods:
moveLeft(interval, speed)
- Starts moving the image to the left at the indicated interval and speed. If the arguments are not provided, it will use the defaults.moveRight(interval, speed)
- Starts moving the image to the right at the indicated interval and speed. If the arguments are not provided, it will use the defaults.stopMoving()
- Stops all motion.
See https://seancoyne.github.io/pano for working example.
$(function(){
var pano = $("#myPano").pano({
img: "/path/to/image.jpg",
interval: 100,
speed: 50
});
pano.moveLeft();
pano.stopMoving();
pano.moveRight();
pano.stopMoving();
});
The plugin supports the CommonJS module system so you can require it using npm and bundle via Browserify.