Giter Site home page Giter Site logo

kumaramit1947 / draggable-sortable-list Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 788 KB

A temple list where items can be dragged and shuffled with respect to each other.

HTML 54.49% JavaScript 17.65% CSS 27.87%
css3 drag-and-drop html5 javascipt sortable-lists

draggable-sortable-list's Introduction

Draggable-Sortable-List

A temple list where items can be dragged and shuffled with respect to each other.

Phase

Frontend, Responsive

Technology used

HTML, CSS, Javascript

Description

  • A list of bar type blocks displaying Temples image and names
  • The individual item from the list can be dragged and placed at some other position in the list
  • The list is then shuffled and sorted accordingly

Implementation

  1. All the items are made draggable=true to allow the dragging.
  2. All items are attached with 2 subsequent Event Listeners:
    1. dragstart : triggered when the item is started to be dragged.
    2. dragend : triggered when the item is strop dragging i.e., dropped.
  3. The opacity of the item dragged is reduced to 0 on dragstart and after the drag ends it is again made opaque to be visible.
  4. The drop space where the dragged item can be dropped is attached with another Event Listener: dragover , which is triggered when any item is dragged over the corresponding drop space.
  5. The item dragged occupies the new position in the list just above another item over which it is dropped.
  6. This item (above which the dragged item is placed) is the position closest to the drop point below it and is calculated by: clientY of the dragging item < offsetTop + offsetHeight/2 of the replaceable item

Concepts implemented

  • Event listeners: dragstart, dragend, dragover
  • Flexbox
  • Sortable listing

Future

  • Implement grab cursor on item while dragging
  • Holding the dragged item opaque while the leftover space should be transparent
  • Items fetched from some API

Demo video

draggableVideo.mp4

Snapshots

Draggable2

Draggable1

draggable-sortable-list's People

Contributors

kumaramit1947 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.