GithubHelp home page GithubHelp logo

phatmann / jquery.simulate.drag-sortable.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mattheworiordan/jquery.simulate.drag-sortable.js

1.0 2.0 0.0 121 KB

Simulate drag events within a JQuery UI Sortable widget (primarily for integration testing)

License: MIT License

JavaScript 100.00%

jquery.simulate.drag-sortable.js's Introduction

Simulate Drag on JQuery UI Sortable

Whilst jquery.simulate.js provides functionality to simulate many JQuery and JQuery UI event, it is unable to simulate a drag event for a JQuery UI Sortable widget due to the intricate behaviour needed to make the JQuery UI Sortable widget fire the correct events.

This library allows you to simulate Drag events for a JQuery UI Sortable, which I have found most useful when doing thorough integration tests.

Features

  • You can simulate an item being dragged up or down within a Sortable list by a specified number of items
  • Support for drag handles
  • Support for place holders
  • Support for limiting list to items which match a selector

Known limitations

  • Currently does not work with linked lists
  • Does not support horizontally ordered lists
  • beforeStop event does not fire

Usage

Include jquery.simulate.drag-sortable.js file after JQuery has been included.

// drag item down one position in the list
$('#itemToDrag').simulateDragSortable({ move: 1 });

// drag item down one position in the list and only treat elements which match .draggable as part of the list
$('#itemToDrag').simulateDragSortable({ move: 1, listItem: '.draggable });

// drag item up one position in the list using the handle .handle
$('#itemToDrag').simulateDragSortable({ move: -1, handle: '.handle });

// drag item up two positions in the list with support for a place holder
$('#itemToDrag').simulateDragSortable({ move: -2, placeHolder: '.custom-place-holder' });

Repository and forking

I welcome feedback and commits to this library. Please fork me on Github at https://github.com/mattheworiordan/jquery.simulate.drag-sortable.js

About

This script was written by Matthew O'Riordan

License

jquery.simulate.drag-sortable.js is Copyright © 2011 Matthew O'Riordan, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

jquery.simulate.drag-sortable.js's People

Contributors

mattheworiordan avatar phatmann avatar

Stargazers

 avatar

Watchers

 avatar James Cloos 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.