javascript - How to extend called callback from another function -
i'm not sure title need use or need call i'm gonna do, here problem
there code in sortable.js
var sortablestuff; sortablestuff = { sortablelist = $('#mysortable'); init: function(){ sortablelist.sortable({ start: function(){ lot of codes here... }, stop: function() { codes here.. } }); } }
i want extend start , stop function another file example mysortable.js
still run start , stop callback 1 above.
sortablestuff.sortablelist.sortable({ start: function(){ run code start before.. run new code } })
i'm not javascript expert, , don't know call i'm trying here, please me.
you've got syntax error in first script, mixing object literals variable assignments. should be
var sortablestuff = { sortablelist: $('#mysortable'), // ^ ^ init: function() { this.sortablelist.sortable({ // ^^^^^ use property start: function(){ // lot of codes here... }, stop: function() { // codes here.. } }); } };
now can access sortablestuff.sortablelist
outside, , depending on how sortable
plugin works able extend/add/overwrite callbacks.
Comments
Post a Comment