Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function(jq) {
- var methods = {
- init: function(options) {
- var settings = {
- something: 'value'
- }
- return this.each(function() {
- jq.extend(settings,options);
- //do something for each match
- });
- },
- changestate: function() {
- alert(settings.someSetting); //settings not in scope, id want it to somehow be
- }
- }
- jq.fn.myplugin = function(method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || !method) {
- return methods.init.apply(this, arguments);
- }
- };
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement