npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

judo-spin

v1.0.3

Published

360° degrees image spinner using JavaScript.

Downloads

28

Readme

Judo Spin

360° degrees image spinner and rotation built with vanilla JavaScript.

View Online Demo

Table of Contents

Installation

[A] Download

[B] Package

  • Install with npm: npm install judo-spin
  • Install with yarn: yarn add judo-spin

[C] Get a local working copy of the development repository (Optional) git clone https://github.com/Rodgath/judo-spin.git

Implementation

There are several methods you can use to add Judo Spin into your project.

Method 1

Using data-judo-spin attribute. View Demo

Your HTML code of upto 36 images

<div data-judo-spin='{ "currImage": "6" }'>
  <img src="images/car/01.png" alt="Image 01">
  <img src="images/car/02.png" alt="Image 02">

  <!-- More Images Here -->
  
  <img src="images/car/35.png" alt="Image 35">
  <img src="images/car/36.png" alt="Image 36">
</div>

Enqueue the judoSpin script at the bottom of your markup

  • Using local script file.
<script src="judo-spin.min.js"></script>
<!-- OR -->
<script src="./node_modules/judo-spin/dist/js/judo-spin.min.js"></script>
  • Using CDN file. (Optional)
<script src="https://cdn.jsdelivr.net/npm/judo-spin@latest/dist/js/judo-spin.min.js"></script>
↑ TOP ↑

Method 2

Initializing with judoSpin function. View Demo

Your HTML code of upto 36 images

<div class="image-spin-box">
  <img src="images/car/01.png" alt="Image 01">
  <img src="images/car/02.png" alt="Image 02">

  <!-- More Images Here -->
  
  <img src="images/car/35.png" alt="Image 35">
  <img src="images/car/36.png" alt="Image 36">
</div>

Call the judoSpin() function with two arguments.

...1) The element 'class' or 'id' holding the images

...2) The 'options' object

document.addEventListener('DOMContentLoaded', function() {
  judoSpin('.image-spin-box', { currImage: 1, enableDragHangle: true });
});

Enqueue the judoSpin script at the bottom of your markup

  • Using local script file.
<script src="judo-spin.min.js"></script>
<!-- OR -->
<script src="./node_modules/judo-spin/dist/js/judo-spin.min.js"></script>
  • Using CDN file. (Optional)
<script src="https://cdn.jsdelivr.net/npm/judo-spin@latest/dist/js/judo-spin.min.js"></script>
↑ TOP ↑

Method 3

Using JSON object of images

...[A] - Adding the JSON object inside the data-judo-spin attribute. View Demo

<div data-judo-spin='{ 
    "currImage": 13,
    "images": [
      { "src": "images/car/01.png", "title": "Image 01" },
      { "src": "images/car/02.png", "title": "Image 02" },
      
      // More Images Here

      { "src": "images/car/35.png", "title": "Image 35" },
      { "src": "images/car/36.png", "title": "Image 36" }
    ] 
  }'></div>

...[B] - Add the JSON object inside the judoSpin function. View Demo

HTML code.

<div class="image-rotation-box image-spin-demo"></div>

JavaScript code

document.addEventListener('DOMContentLoaded', function() {
   judoSpin('.image-rotation-box', {
      currImage: 22, 
      images: [
        { "src": "images/car/01.png", "title": "Image 01" },
        { "src": "images/car/02.png", "title": "Image 02" },
        
        // More Images Here

        { "src": "images/car/35.png", "title": "Image 35" },
        { "src": "images/car/36.png", "title": "Image 36" }
      ]
    });
});
↑ TOP ↑

Options

Name | Type | Default | Description :--- | :--- | :------ | :---------- currImage | number | 1 | The default image when judo spin loads. Range is 1 - 36. images | array|object | - | Array of images as JSON object or DOM images. enableDragHandle | boolean | false | Whether to show the drag handler scroller.

License

judoSpin is an open-source project released under the MIT license.


Crafted by Rodgath

↑ TOP ↑