(function($w){ $w.fn.extend({ loading_icon:function(enabled) { return this.each(function() { if (enabled == true) { if (this.loading == true) return; this.loading = true; this.save_background = $w(this).css('background-image'); $w(this).css('background-image','url()'); $w(this).html(''); } else { if (this.loading == undefined || this.loading == false) return; this.loading = false; $w(this).html(''); $w(this).css('background-image',this.save_background); } }); }, //pass the options variable to the function loading_button: function(enabled,options) { //Set the default values, use comma to separate the settings, example: var defaults = { image : '', word: 'Loading' } var options = $w.extend(defaults, options); return this.each(function() { if (enabled == true) { var inside_content = $w(this).html(); $w(this).html(''+options.image + ' ' + options.word+''); $w(this).append(''); } else { var hidden_div = $w('.loading_button_hidden_div',this); if (hidden_div.length == 0) return; $w(this).html($w(hidden_div).html()); } }); } }); })(jQueryWhowishWord);