Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
basicrotate
Advanced tools
Rotate throw a set of 360 degree images using your mouse or finger.
Name | Description | Link |
---|---|---|
Default | Includes most features. | Try it on CodePen |
basicRotate depends on the following browser APIs:
Some of these APIs are capable of being polyfilled in older browsers. Check the linked resources above to determine if you must polyfill to achieve your desired level of browser support.
We recommend installing basicRotate using npm or yarn.
npm install basicrotate
yarn add basicrotate
Include the CSS file in the head
tag and the JS file at the end of your body
tag…
<link rel="stylesheet" href="dist/basicRotate.min.css">
<script src="dist/basicRotate.min.js"></script>
…or skip the JS file and use basicRotate as a module:
const basicRotate = require('basicrotate')
import * as basicRotate from 'basicrotate'
Create an element filled with equal-sized images. Add the basicRotate
class and initialize basicRotate using the basicRotate.create
function. That's it!
<div class="basicRotate">
<img src="1.jpg">
<img src="2.jpg">
<img src="3.jpg">
<!-- ... -->
</div>
basicRotate.create(document.querySelector('.basicRotate'))
Creates a new basicRotate instance.
Be sure to assign your instance to a variable. Using your instance, you can…
Examples:
const instance = basicRotate.create(document.querySelector('#rotate'))
const instance = basicRotate.create(document.querySelector('#rotate'), {
index: 1,
tolerance: 5
})
const instance = basicRotate.create(document.querySelector('#rotate'), {
beforeChange: (instance, newIndex, oldIndex) => console.log('beforeChange', instance, newIndex, oldIndex),
afterChange: (instance, newIndex, oldIndex) => console.log('afterChange', instance, newIndex, oldIndex)
})
Parameters:
elem
{Node}
The DOM element/node which contains all images.opts
{?Object}
An object of options.Returns:
{Object}
The created instance.Each basicRotate instance has a handful of handy functions. Below are all of them along with a short description.
Returns the current image index.
Example:
const current = instance.current()
Returns:
{Number}
Current image index.Navigates to an image by index and executes the beforeChange and afterChange callback functions.
Example:
instance.goto(0)
Parameters:
newIndex
{Number}
Index of the image to be displayed.Navigates to the previous image and executes the beforeChange and afterChange callback functions.
Example:
instance.prev()
Navigates to the next image and executes the beforeChange and afterChange callback functions.
Example:
instance.next()
The option object can include the following properties:
{
/*
* Initial image.
*/
index: 0,
/*
* Rotate image by dragging.
*/
draggable: true,
/*
* Dragging tolerance.
* Small number (1) = Very sensitive = Fast.
* Large number (∞) = Very insensitive = Slow.
*/
tolerance: 10,
/*
* Dragging direction.
* x (or basicRotate.DIRECTION_X) = Detect movements on the x-axis.
* y (or basicRotate.DIRECTION_Y) = Detect movements on the y-axis.
*/
index: 'x',
/*
* Callback functions.
* Returning false will stop the caller function and prevent the image from changing.
*/
beforeChange: (instance, newIndex, oldIndex) => {},
afterChange: (instance, newIndex, oldIndex) => {}
}
[1.1.1] - 2020-03-20
FAQs
Rotate throw a set of 360 degree images using your mouse or finger
We found that basicrotate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.