Created
March 14, 2013 07:19
-
-
Save benmorrow/5159470 to your computer and use it in GitHub Desktop.
Meteor Template.rendered for JQueryUI Draggable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Template.item.rendered = function () { | |
var item = Items.findOne(this.data._id); | |
var item_left = item.left; | |
var item_top = item.top; | |
$(this.find('.draggable')).draggable({ | |
cursor: 'move', stop: | |
function () { | |
var self = $(this); | |
Items.update(this._id, {$set: {top: self.css('top'), left: self.css('left')}}); | |
} | |
}).css({'top': item_top, 'left': item_left }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment