Skip to content

Instantly share code, notes, and snippets.

@benmorrow
Created March 14, 2013 07:19
Show Gist options
  • Save benmorrow/5159470 to your computer and use it in GitHub Desktop.
Save benmorrow/5159470 to your computer and use it in GitHub Desktop.
Meteor Template.rendered for JQueryUI Draggable
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