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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -