Skip to content

Commit

Permalink
📝 create .github/; revise README
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Mar 27, 2018
1 parent 2b197e8 commit 15190d0
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 69 deletions.
27 changes: 27 additions & 0 deletions .github/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Submitting issues

### Reduced test case required

All bug reports and problem issues require a [**reduced test case**](https://css-tricks.com/reduced-test-cases/). Create one by forking any one of the [CodePen demos](https://codepen.io/desandro/pens/tags/?grid_type=list&selected_tag=draggabilly-docs&sort_order=asc) from [the docs](https://draggabilly.desandro.com). Try forking these CodePens:

**CodePens**

+ [basic jQuery demo](https://codepen.io/desandro/pen/yyRapr)
+ [basic vanilla JS demo](https://codepen.io/desandro/pen/EadgXx)

**Test cases**

+ A reduced test case clearly demonstrates the bug or issue.
+ It contains the bare minimum HTML, CSS, and JavaScript required to demonstrate the bug.
+ A link to your production site is **not** a reduced test case.

Providing a reduced test case is the best way to get your issue addressed. They help you point out the problem. They help me verify and debug the problem. They help others understand the problem. Without a reduced test case, your issue may be closed.

## Pull requests

_Contributions are appreciated!_

+ _Typos and one-line fixes:_ send them right in.
+ _Larger changes_ like new features: **ask first** by opening a new issue. I can be particular about my vision for Draggabilly. I do not want you to spend effort on code that I may not wish to merge.
+ **Follow the code style.** 2-space indentation, spaces in brackets, semicolons, trailing commas.
+ **Do not run `gulp` and update `dist/` files.** I'll take care of this after merging.
3 changes: 3 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- Thanks for submitting an issue! All bug reports and problem issues require a **reduced test case**. Create one by forking any one of the CodePen examples from the docs. See guidelines link above. -->

**Test case:** https://codepen.io/desandro/pen/yyRapr
125 changes: 67 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

[draggabilly.desandro.com](https://draggabilly.desandro.com)

Rad because it supports IE10+ and multi-touch.
Rad because it supports IE10+ and touch devices.

## Install

Grab a packaged source file:
### Download

+ [draggabilly.pkgd.min.js](https://unpkg.com/draggabilly@2/dist/draggabilly.pkgd.min.js) minified
+ [draggabilly.pkgd.js](https://unpkg.com/draggabilly@2/dist/draggabilly.pkgd.js) un-minified
Expand All @@ -21,12 +21,10 @@ Install with [Bower](https://bower.io): `bower install draggabilly`

### CDN

Link directly to Draggabilly files on [unpkg.com](https://unpkg.com).
Link directly to `draggabilly.pkgd.min.js` on [unpkg.com](https://unpkg.com).

``` html
<script src="https://unpkg.com/draggabilly@2/dist/draggabilly.pkgd.min.js"></script>
<!-- or -->
<script src="https://unpkg.com/draggabilly@2/dist/draggabilly.pkgd.js"></script>
```

## Usage
Expand Down Expand Up @@ -58,7 +56,7 @@ var draggableElems = document.querySelectorAll('.draggable');
// array of Draggabillies
var draggies = []
// init Draggabillies
for ( var i=0, len = draggableElems.length; i < len; i++ ) {
for ( var i=0; i < len = draggableElems.length; i++ ) {
var draggableElem = draggableElems[i];
var draggie = new Draggabilly( draggableElem, {
// options...
Expand Down Expand Up @@ -315,12 +313,51 @@ console.log( 'draggie at ' + draggie.position.x + ', ' + draggie.position.y )

### position

`{ x: 20, y: -30 }`
``` js
draggie.position
// => { x: 20, y: -30 }
```

+ `position` - **Type:** _Object_
+ `x` - **Type:** _Number_
+ `y` - **Type:** _Number_

## Module loaders

### Webpack & Browserify

Install [Draggabilly with npm](https://www.npmjs.com/package/draggabilly).

```
npm install draggabilly
```

``` js
var Draggabilly = require('draggabilly');

var draggie = new Draggabilly( '.draggable', {
// options
});
```

To use Draggabilly as a jQuery plugin, you need to install and call [jQuery Bridget](https://github.com/desandro/jquery-bridget).

```
npm install jquery-bridget
```

``` js
var $ = require('jquery');
var jQueryBridget = require('jquery-bridget');
var Draggabilly = require('draggabilly');

+ `x` _Integer_
+ `y` _Integer_
// make Draggabilly a jQuery plugin
jQueryBridget( 'draggabilly', Draggabilly, $ );
// now you can use $().draggabilly()
$('.draggable').draggabilly({...})
```

## RequireJS
### RequireJS

Draggabilly works with [RequireJS](http://requirejs.org).

Expand All @@ -330,34 +367,35 @@ You can require `draggabilly.pkgd.js`..
requirejs( [
'path/to/draggabilly.pkgd.js',
], function( Draggabilly ) {
new Draggabilly( ... );
new Draggabilly( '.draggable', {...});
});
```

To use Draggabilly as a jQuery plugin with RequireJS and draggabilly.pkgd.js, you need to call jQuery Bridget.
To use Draggabilly as a jQuery plugin with RequireJS and `draggabilly.pkgd.js`, you need to call jQuery Bridget.

``` js
// require the require function
requirejs( [ 'require', 'jquery', 'path/to/draggabilly.pkgd.js' ],
function( require, $, Draggabilly ) {
// require jquery-bridget, it's included in draggabilly.pkgd.js
require( [ 'jquery-bridget/jquery-bridget' ],
function() {
function( jQueryBridget ) {
// make Draggabilly a jQuery plugin
$.bridget( 'draggabilly', Draggabilly );
jQueryBridget( 'draggabilly', Draggabilly, $ );
// now you can use $().draggabilly()
$('.draggable').draggabilly({...})
}
);
});
```

Or, you can manage dependencies with [Bower](http://bower.io). Set `baseUrl` to `bower_components` and set a path config for all your application code.
Or, you can manage dependencies with a package manager like npm or Bower. Set `baseUrl` to the package directory and set a path config for all your application code.

``` js
requirejs.config({
baseUrl: 'bower_components/',
paths: { // path your your app
baseUrl: 'node_modules/',
paths: {
// path your your app
app: '../'
}
});
Expand All @@ -370,70 +408,41 @@ requirejs( [
});
```

You can require Bower dependencies and use Isotope as a jQuery plugin with jQuery Bridget.
To use Draggabilly as a jQuery plugin with a package manager, you need install and to call [jQuery Bridget](https://github.com/desandro/jquery-bridget).

``` js
requirejs.config({
baseUrl: '../bower_components',
baseUrl: 'node_modules/',
paths: {
jquery: 'jquery/jquery'
jquery: 'jquery/dist/jquery'
}
});

requirejs( [
'jquery',
'draggabilly/draggabilly',
'jquery-bridget/jquery.bridget'
'jquery-bridget/jquery-bridget'
],
function( $, Draggabilly ) {
function( $, Draggabilly, jQueryBridget ) {
// make Draggabilly a jQuery plugin
$.bridget( 'draggabilly', Draggabilly );
jQueryBridget( 'draggabilly', Draggabilly, $ );
// now you can use $().draggabilly()
$('.draggable').draggabilly({...})
});
```

## Browserify

Draggabilly works with [Browserify](http://browserify.org/). Install [Draggabilly with npm](https://www.npmjs.com/package/draggabilly).

```
npm install draggabilly
```

``` js
var Draggabilly = require('draggabilly');

var draggie = new Draggabilly( '.draggable', {
// options
});
```

To use Draggabilly as a jQuery plugin with Browserify, you need to call jQuery Bridget.

```
npm install jquery-bridget
```

``` js
var $ = require('jquery');
require('jquery-bridget');
var Draggabilly = require('draggabilly');

// make Draggabilly a jQuery plugin
$.bridget( 'draggabilly', Draggabilly );
// now you can use $().draggabilly()
$('.draggable').draggabilly({...})
```

## Browser support

Draggabilly v2.2 supports Chrome 36+, Firefox 23+, Safari 9+ (mobile & desktop), IE10+, and Edge 12+.

Use Draggabilly v2.1 for Android 4+ and Safari 6+ support.
Use [Draggabilly v2.1](https://github.com/desandro/draggabilly/releases/tag/v2.1.1) for Android 4+ and Safari 6+ support.

Use [Draggabilly v1 for IE8 & 9, and Android 2.3+ support](https://draggabilly.desandro.com/v1)
Use [Draggabilly v1](https://draggabilly.desandro.com/v1) for IE8 & 9, and Android 2.3+ support.

## License

Draggabilly is released under the [MIT License](https://desandro.mit-license.org/). Have at it.

---

Made by [David DeSandro](https://desandro.com) 😻
11 changes: 0 additions & 11 deletions contributing.md

This file was deleted.

0 comments on commit 15190d0

Please sign in to comment.