Sha256: 949b22d5765b41c1ab8026fef3cad0d296a747362ad9e7b816770d5283825cc7
Contents?: true
Size: 1.33 KB
Versions: 29
Compression:
Stored size: 1.33 KB
Contents
// CytoField v0.1 // By MacKinley Smith (function($){ var defaults = { widget:{ field:{ } }, events:{ create:function(cy){}, change:function(cy,event){}, destroy:function(cy){} } }; var methods = { init:function(options){ return this.each(function(){ var $this = $(this); var settings = $.extend(true,{},defaults,options); // Setup widget $this.data('cytoField',settings); methods.resize.apply($this); }); }, resize:function(){ return this.each(function(){ var $this = $(this); var settings = $this.data('cytoField'); if (settings==null) return console.warn("You must instantiate $.cytoField before you call the resize method!"); $this.width("100%"); setTimeout(function(){ $this.width($this.width()-16); },1); }); }, destroy:function(){ return this.each(function(){ }); } }; $.fn.cytoField=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); else $.error('Method ' + method + ' does not exist on $.cytoField!'); }; $(window).resize(function(){$('.cytoField').cytoField('resize');}); $.Cytoplasm("ready",function(){$('.cytoField').cytoField();}); })(jQuery);
Version data entries
29 entries across 29 versions & 1 rubygems