Reputation: 23
I was wondering how or if it's possible to pass a variable from 'start:' to 'update:' in the function below, without making the variable global?
Thanks.
$('.type').sortable({
placeholder: 'entityHighlight',
cancel: '.disabled',
opacity: 0.9,
revert: true,
scroll: true,
start:function(event,ui) {
startPos = ui.item.index();
},
update: function(event,ui) {
var endPos = ui.item.index();
var entityId = ui.item.attr('id');
voteRank(entityId,startPos,endPos);
}
}).disableSelection();
Upvotes: 2
Views: 2424