Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
add function support for draggable clone option
Browse files Browse the repository at this point in the history
Refs #34
  • Loading branch information
rkusa committed May 15, 2015
1 parent 48cb43c commit de15e32
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions touch-dnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,20 +502,24 @@
if (!isHandle) return false
}

var el = this.el, handle
var el = this.el, helper
if (this.opts.clone) {
handle = this.el.clone()
if (typeof this.opts.clone === 'function') {
helper = this.opts.clone.call(this.el)
} else {
helper = this.el.clone()
if (this.opts.cloneClass) {
helper.addClass(this.opts.cloneClass)
}
}
var position = this.el.position()
handle.css('position', 'absolute')
helper.css('position', 'absolute')
.css('left', position.left).css('top', position.top)
.width(this.el.width()).height(this.el.height())
if (this.opts.cloneClass) {
handle.addClass(this.opts.cloneClass)
}
handle.insertAfter(this.el)
helper.insertAfter(this.el)
}

dragging.start(this, this.el, e, handle)
dragging.start(this, this.el, e, helper)

trigger(this.el, 'draggable:start', e, { item: dragging.el })
}
Expand Down

0 comments on commit de15e32

Please sign in to comment.