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

dragking

v1.2.0

Published

The Drag Library allows users to implement drag-and-drop functionality for any element within a specified box area. With this library, developers can effortlessly enable dragging of HTML elements, making it a versatile tool for interactive web application

Downloads

21

Readme

DragKing

The DragKing library empowers developers to easily implement drag-and-drop functionality for HTML elements within a specified container. This versatile tool makes it effortless for developers to enable dragging of HTML elements, enhancing the interactivity of web applications. DragKing offers seamless integration and extensive customization options, allowing developers to create dynamic and engaging user interfaces effortlessly.

Features

  • Drag-and-Drop: Implement drag-and-drop functionality for HTML elements with ease.
  • Customization: Customize the drag behavior to suit your application's needs.
  • Effortless Integration: Easily integrate DragKing into your web projects.
  • Enhanced User Experience: Create dynamic and interactive user interfaces.
  • Versatile Usage: Suitable for a wide range of web applications.

Installation

You can install DragKing using npm:

npm install dragking

Usage

To get started with DragKing, follow these steps:

  1. Installation: Install DragKing as mentioned above.

  2. Initialization:

    import  Drag  from "dragking";
    
    let drag = new Drag("#drag-area", ".drag-item");
  3. Start Dragging:

    Call the start() method to enable drag-and-drop functionality:

    drag.start();
  4. HTML Structure:

    Ensure you have the necessary HTML structure with a container and draggable elements, as shown below:

    <div id="drag-area" style="border: 1px solid black; width: 500px; height: 500px; margin-left: 100px;"></div>
    <img src="./icon.png" class="drag-item" alt="" width="60px" srcset=""/>
    <!-- Add more draggable elements as needed -->
  5. View the demo DragKing demo.

  6. For more detailed information and examples, please refer to the DragKing Documentation.

Explanation of new Drag("#drag-area", ".drag-item")

The code new Drag("#drag-area", ".drag-item") creates a new instance (object) of the Drag class, enabling drag-and-drop functionality within your web application. Here's an explanation of this code:

  1. "#drag-area": This CSS selector targets the container element where drag-and-drop functionality will be enabled. It uses the # symbol followed by drag-area, typically representing the id attribute of an HTML element. This means it will target a unique HTML element with an id attribute equal to "drag-area" as the drag-and-drop container.

  2. ".drag-item": This selector targets the draggable items within the specified container. It selects the HTML elements that users can drag within the defined container, allowing interactive user experiences.

Now, with this code, you can easily implement drag-and-drop functionality in your web application. Enjoy enhanced interactivity and dynamic user interfaces!