All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.component.assets.js.ace.elements.spinner.js Maven / Gradle / Ivy

There is a newer version: 3.0.1.11
Show newest version
/**
 Spinner. A wrapper for FuelUX spinner element.
 It's just a wrapper so you still need to include FuelUX spinner script first.
*/
(function($ , undefined) {
	//a wrapper for fuelux spinner
	function Ace_Spinner(element , options) {
		var max = options.max
		max = (''+max).length
		var width = parseInt(Math.max((max * 20 + 40) , 90))

		var $element = $(element);
		$element.addClass('spinbox-input form-control').wrap('
') var $parent_div = $element.closest('.ace-spinner').spinbox(options).wrapInner("
") var $spinner = $parent_div.data('fu.spinbox'); if(options.on_sides) { $element .before('
\ \
') .after('
\ \
'); $parent_div.addClass('touch-spinner') $parent_div.css('width' , width+'px') } else { $element .after('
\ \ \
') if(ace.vars['touch'] || options.touch_spinner) { $parent_div.addClass('touch-spinner') $parent_div.css('width' , width+'px') } else { $element.next().addClass('btn-group-vertical'); $parent_div.css('width' , width+'px') } } $parent_div.on('changed', function(){ $element.trigger('change')//trigger the input's change event }); this._call = function(name, arg) { $spinner[name](arg); } } $.fn.ace_spinner = function(option, value) { var retval; var $set = this.each(function() { var $this = $(this); var data = $this.data('ace_spinner'); var options = typeof option === 'object' && option; if (!data) { options = $.extend({}, $.fn.ace_spinner.defaults, option); $this.data('ace_spinner', (data = new Ace_Spinner(this, options))); } if (typeof option === 'string') retval = data._call(option, value); }); return (retval === undefined) ? $set : retval; } $.fn.ace_spinner.defaults = { 'icon_up' : 'fa fa-chevron-up', 'icon_down': 'fa fa-chevron-down', 'on_sides': false, 'btn_up_class': '', 'btn_down_class' : '', 'max' : 999, 'touch_spinner': false } })(window.jQuery);




© 2015 - 2025 Weber Informatics LLC | Privacy Policy