Need to test AccountPlan on Mono
This commit is contained in:
@@ -1,302 +1,287 @@
|
||||
/**
|
||||
* jquery.switchButton.js v1.0
|
||||
* jQuery iPhone-like switch button
|
||||
* @author Olivier Lance <olivier.lance@sylights.com>
|
||||
*
|
||||
* Copyright (c) Olivier Lance - released under MIT License {{{
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
* }}}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Meant to be used on a <input type="checkbox">, this widget will replace the receiver element with an iPhone-style
|
||||
* switch button with two states: "on" and "off".
|
||||
* Labels of the states are customizable, as are their presence and position. The receiver element's "checked" attribute
|
||||
* is updated according to the state of the switch, so that it can be used in a <form>.
|
||||
* jQuery switchbutton
|
||||
*
|
||||
* Based on work by tdreyno on iphone-style-checkboxes for events management
|
||||
* (https://github.com/tdreyno/iphone-style-checkboxes)
|
||||
*
|
||||
* Copyright 2011, L.STEVENIN
|
||||
* Released under the MIT license.
|
||||
*
|
||||
* Depends:
|
||||
* jquery.ui.widget.js (jQuery UI Widget Factory - http://wiki.jqueryui.com/w/page/12138135/Widget%20factory)
|
||||
* jquery.tmpl.js (jQuery Templates - http://api.jquery.com/category/plugins/templates/)
|
||||
*/
|
||||
(function ($, switchbutton) {
|
||||
|
||||
(function($) {
|
||||
|
||||
$.widget("sylightsUI.switchButton", {
|
||||
$.widget('switchbutton.switchbutton', {
|
||||
|
||||
options: {
|
||||
checked: undefined, // State of the switch
|
||||
|
||||
show_labels: true, // Should we show the on and off labels?
|
||||
labels_placement: "both", // Position of the labels: "both", "left" or "right"
|
||||
on_label: "ON", // Text to be displayed when checked
|
||||
off_label: "OFF", // Text to be displayed when unchecked
|
||||
|
||||
width: 25, // Width of the button in pixels
|
||||
height: 11, // Height of the button in pixels
|
||||
button_width: 12, // Width of the sliding part in pixels
|
||||
|
||||
clear: true, // Should we insert a div with style="clear: both;" after the switch button?
|
||||
clear_after: null, // Override the element after which the clearing div should be inserted (null > right after the button)
|
||||
on_callback: undefined, //callback function that will be executed after going to on state
|
||||
off_callback: undefined //callback function that will be executed after going to off state
|
||||
classes: '',
|
||||
duration: 200,
|
||||
dragThreshold: 5,
|
||||
autoResize: true,
|
||||
labels: true,
|
||||
checkedLabel: 'ON',
|
||||
uncheckedLabel: 'OFF',
|
||||
disabledClass: 'ui-switchbutton-disabled ui-state-disabled',
|
||||
template: '<div class="ui-switchbutton ui-switchbutton-default ${classes} {{if !labels}}ui-switchbutton-no-labels{{/if}}" tabindex=0>' +
|
||||
'<label class="ui-switchbutton-disabled">' +
|
||||
'<span>{{if labels}}${uncheckedLabel}{{/if}}</span>' +
|
||||
'</label>' +
|
||||
'<label class="ui-switchbutton-enabled">' +
|
||||
'<span>{{if labels}}${checkedLabel}{{/if}}</span>' +
|
||||
'</label>' +
|
||||
'<div class="ui-switchbutton-handle"></div>' +
|
||||
'</div>'
|
||||
},
|
||||
|
||||
_create: function() {
|
||||
// Init the switch from the checkbox if no state was specified on creation
|
||||
if (this.options.checked === undefined) {
|
||||
this.options.checked = this.element.prop("checked");
|
||||
}
|
||||
|
||||
this._initLayout();
|
||||
this._initEvents();
|
||||
},
|
||||
|
||||
_initLayout: function() {
|
||||
// Hide the receiver element
|
||||
this.element.hide();
|
||||
|
||||
// Create our objects: two labels and the button
|
||||
this.off_label = $("<span>").addClass("switch-button-label");
|
||||
this.on_label = $("<span>").addClass("switch-button-label");
|
||||
|
||||
this.button_bg = $("<div>").addClass("switch-button-background");
|
||||
this.button = $("<div>").addClass("switch-button-button");
|
||||
|
||||
// Insert the objects into the DOM
|
||||
this.off_label.insertAfter(this.element);
|
||||
this.button_bg.insertAfter(this.off_label);
|
||||
this.on_label.insertAfter(this.button_bg);
|
||||
|
||||
this.button_bg.append(this.button);
|
||||
|
||||
// Insert a clearing element after the specified element if needed
|
||||
if(this.options.clear)
|
||||
{
|
||||
if (this.options.clear_after === null) {
|
||||
this.options.clear_after = this.on_label;
|
||||
}
|
||||
$("<div>").css({
|
||||
clear: "left"
|
||||
}).insertAfter(this.options.clear_after);
|
||||
}
|
||||
|
||||
// Call refresh to update labels text and visibility
|
||||
this._refresh();
|
||||
|
||||
// Init labels and switch state
|
||||
// This will animate all checked switches to the ON position when
|
||||
// loading... this is intentional!
|
||||
this.options.checked = !this.options.checked;
|
||||
this._toggleSwitch();
|
||||
},
|
||||
|
||||
_refresh: function() {
|
||||
// Refresh labels display
|
||||
if (this.options.show_labels) {
|
||||
this.off_label.show();
|
||||
this.on_label.show();
|
||||
}
|
||||
else {
|
||||
this.off_label.hide();
|
||||
this.on_label.hide();
|
||||
}
|
||||
|
||||
// Move labels around depending on labels_placement option
|
||||
switch(this.options.labels_placement) {
|
||||
case "both":
|
||||
{
|
||||
// Don't move anything if labels are already in place
|
||||
if(this.button_bg.prev() !== this.off_label || this.button_bg.next() !== this.on_label)
|
||||
{
|
||||
// Detach labels form DOM and place them correctly
|
||||
this.off_label.detach();
|
||||
this.on_label.detach();
|
||||
this.off_label.insertBefore(this.button_bg);
|
||||
this.on_label.insertAfter(this.button_bg);
|
||||
|
||||
// Update label classes
|
||||
this.on_label.addClass(this.options.checked ? "on" : "off").removeClass(this.options.checked ? "off" : "on");
|
||||
this.off_label.addClass(this.options.checked ? "off" : "on").removeClass(this.options.checked ? "on" : "off");
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "left":
|
||||
{
|
||||
// Don't move anything if labels are already in place
|
||||
if(this.button_bg.prev() !== this.on_label || this.on_label.prev() !== this.off_label)
|
||||
{
|
||||
// Detach labels form DOM and place them correctly
|
||||
this.off_label.detach();
|
||||
this.on_label.detach();
|
||||
this.off_label.insertBefore(this.button_bg);
|
||||
this.on_label.insertBefore(this.button_bg);
|
||||
|
||||
// update label classes
|
||||
this.on_label.addClass("on").removeClass("off");
|
||||
this.off_label.addClass("off").removeClass("on");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case "right":
|
||||
{
|
||||
// Don't move anything if labels are already in place
|
||||
if(this.button_bg.next() !== this.off_label || this.off_label.next() !== this.on_label)
|
||||
{
|
||||
// Detach labels form DOM and place them correctly
|
||||
this.off_label.detach();
|
||||
this.on_label.detach();
|
||||
this.off_label.insertAfter(this.button_bg);
|
||||
this.on_label.insertAfter(this.off_label);
|
||||
|
||||
// update label classes
|
||||
this.on_label.addClass("on").removeClass("off");
|
||||
this.off_label.addClass("off").removeClass("on");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Refresh labels texts
|
||||
this.on_label.html(this.options.on_label);
|
||||
this.off_label.html(this.options.off_label);
|
||||
|
||||
// Refresh button's dimensions
|
||||
this.button_bg.width(this.options.width);
|
||||
this.button_bg.height(this.options.height);
|
||||
this.button.width(this.options.button_width);
|
||||
this.button.height(this.options.height);
|
||||
},
|
||||
|
||||
_initEvents: function() {
|
||||
var self = this;
|
||||
|
||||
// Toggle switch when the switch is clicked
|
||||
this.button_bg.click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
self._toggleSwitch();
|
||||
return false;
|
||||
});
|
||||
this.button.click(function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
self._toggleSwitch();
|
||||
return false;
|
||||
});
|
||||
|
||||
// Set switch value when clicking labels
|
||||
this.on_label.click(function(e) {
|
||||
if (self.options.checked && self.options.labels_placement === "both") {
|
||||
return false;
|
||||
}
|
||||
|
||||
self._toggleSwitch();
|
||||
return false;
|
||||
});
|
||||
|
||||
this.off_label.click(function(e) {
|
||||
if (!self.options.checked && self.options.labels_placement === "both") {
|
||||
return false;
|
||||
}
|
||||
|
||||
self._toggleSwitch();
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
_setOption: function(key, value) {
|
||||
if (key === "checked") {
|
||||
this._setChecked(value);
|
||||
_create: function () {
|
||||
if (!this.element.is(':checkbox')) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.options[key] = value;
|
||||
this._refresh();
|
||||
this._wrapCheckboxInContainer();
|
||||
this._attachEvents();
|
||||
this._globalEvents();
|
||||
this._disableTextSelection();
|
||||
|
||||
if (this.element.prop('checked')) {
|
||||
this.$container.toggleClass('ui-state-active', this.element.prop('checked'));
|
||||
}
|
||||
|
||||
if (this.options.autoResize) {
|
||||
this._autoResize();
|
||||
}
|
||||
|
||||
this._initialPosition();
|
||||
},
|
||||
|
||||
_setChecked: function(value) {
|
||||
if (value === this.options.checked) {
|
||||
_wrapCheckboxInContainer: function () {
|
||||
this.$container = $.tmpl(this.options.template, this.options);
|
||||
|
||||
this.element.after(this.$container);
|
||||
this.element.remove();
|
||||
this.$container.append(this.element);
|
||||
|
||||
this.$disabledLabel = this.$container.children('.ui-switchbutton-disabled');
|
||||
this.$disabledSpan = this.$disabledLabel.children('span');
|
||||
this.$enabledLabel = this.$container.children('.ui-switchbutton-enabled');
|
||||
this.$enabledSpan = this.$enabledLabel.children('span');
|
||||
this.$handle = this.$container.children('.ui-switchbutton-handle');
|
||||
},
|
||||
|
||||
_attachEvents: function () {
|
||||
var obj = this;
|
||||
|
||||
this.$container
|
||||
|
||||
// Listen for keyboard events such as <space>, <left> and <right>
|
||||
.bind('keydown', function (event) {
|
||||
|
||||
//Ignore if a key combo was used
|
||||
if (event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Catch <space>, <left>, and <right>
|
||||
if (event.keyCode == 32 || event.keyCode == 37 || event.keyCode == 39) event.preventDefault();
|
||||
|
||||
//Ignore if the element is disabled
|
||||
if (obj.element.prop('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Determine if we're supposed to toggle
|
||||
var checked = obj.element.prop('checked')
|
||||
if (event.keyCode == 32 || (event.keyCode == 37 && checked) || (event.keyCode == 39 && !checked)) {
|
||||
|
||||
//Perform the toggle
|
||||
var willChangeEvent = jQuery.Event('willChange');
|
||||
obj.element.trigger(willChangeEvent);
|
||||
if (willChangeEvent.isDefaultPrevented()) return;
|
||||
|
||||
checked = !checked;
|
||||
|
||||
obj.element.prop('checked', checked);
|
||||
obj.$container.toggleClass('ui-state-active', checked);
|
||||
obj.element.change();
|
||||
obj.element.trigger('didChange');
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
// A mousedown anywhere in the control will start tracking for dragging
|
||||
.bind('mousedown touchstart', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (obj.element.prop('disabled')) { return; }
|
||||
|
||||
$(this).focus();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
$[switchbutton].currentlyClicking = obj.$handle;
|
||||
$[switchbutton].dragStartPosition = x;
|
||||
$[switchbutton].handleLeftOffset = parseInt(obj.$handle.css('left'), 10) || 0;
|
||||
$[switchbutton].dragStartedOn = obj.element;
|
||||
})
|
||||
|
||||
// Utilize event bubbling to handle drag on any element beneath the container
|
||||
.bind('iPhoneDrag', function (event, x) {
|
||||
event.preventDefault();
|
||||
|
||||
if (obj.element.prop('disabled')) { return; }
|
||||
if (obj.element != $[switchbutton].dragStartedOn) { return; }
|
||||
|
||||
var p = (x + $[switchbutton].handleLeftOffset - $[switchbutton].dragStartPosition) / obj.rightSide;
|
||||
if (p < 0) { p = 0; }
|
||||
if (p > 1) { p = 1; }
|
||||
obj.$handle.css({ 'left': p * obj.rightSide });
|
||||
obj.$enabledLabel.css({ 'width': p * obj.rightSide });
|
||||
obj.$disabledSpan.css({ 'margin-right': -p * obj.rightSide });
|
||||
obj.$enabledSpan.css({ 'margin-left': -(1 - p) * obj.rightSide });
|
||||
})
|
||||
|
||||
// Utilize event bubbling to handle drag end on any element beneath the container
|
||||
.bind('iPhoneDragEnd', function (event, x) {
|
||||
if (obj.element.prop('disabled')) { return; }
|
||||
|
||||
var willChangeEvent = jQuery.Event('willChange');
|
||||
obj.element.trigger(willChangeEvent);
|
||||
if (willChangeEvent.isDefaultPrevented()) {
|
||||
checked = obj.element.prop('checked');
|
||||
}
|
||||
else {
|
||||
var checked;
|
||||
if ($[switchbutton].dragging) {
|
||||
var p = (x - $[switchbutton].dragStartPosition) / obj.rightSide;
|
||||
checked = (p < 0) ? Math.abs(p) < 0.5 : p >= 0.5;
|
||||
}
|
||||
else {
|
||||
checked = !obj.element.prop('checked');
|
||||
}
|
||||
}
|
||||
|
||||
$[switchbutton].currentlyClicking = null;
|
||||
$[switchbutton].dragging = null;
|
||||
|
||||
obj.element.prop('checked', checked);
|
||||
obj.$container.toggleClass('ui-state-active', checked);
|
||||
obj.element.change();
|
||||
obj.element.trigger('didChange');
|
||||
});
|
||||
|
||||
// Animate when we get a change event
|
||||
this.element.change(function () {
|
||||
obj.refresh();
|
||||
|
||||
var new_left = obj.element.prop('checked') ? obj.rightSide : 0;
|
||||
|
||||
obj.$handle.animate({ 'left': new_left }, obj.options.duration);
|
||||
obj.$enabledLabel.animate({ 'width': new_left }, obj.options.duration);
|
||||
obj.$disabledSpan.animate({ 'margin-right': -new_left }, obj.options.duration);
|
||||
obj.$enabledSpan.animate({ 'margin-left': new_left - obj.rightSide }, obj.options.duration);
|
||||
});
|
||||
},
|
||||
|
||||
_globalEvents: function () {
|
||||
if ($[switchbutton].initComplete) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.options.checked = !value;
|
||||
this._toggleSwitch();
|
||||
var opt = this.options;
|
||||
|
||||
$(document)
|
||||
// As the mouse moves on the page, animate if we are in a drag state
|
||||
.bind('mousemove touchmove', function (event) {
|
||||
if (!$[switchbutton].currentlyClicking) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
if (!$[switchbutton].dragging && (Math.abs($[switchbutton].dragStartPosition - x) > opt.dragThreshold)) {
|
||||
$[switchbutton].dragging = true;
|
||||
}
|
||||
|
||||
$(event.target).trigger('iPhoneDrag', [x]);
|
||||
})
|
||||
|
||||
// When the mouse comes up, leave drag state
|
||||
.bind('mouseup touchend', function (event) {
|
||||
if (!$[switchbutton].currentlyClicking) { return; }
|
||||
event.preventDefault();
|
||||
|
||||
var x = event.pageX || event.originalEvent.changedTouches[0].pageX;
|
||||
$($[switchbutton].currentlyClicking).trigger('iPhoneDragEnd', [x]);
|
||||
});
|
||||
},
|
||||
|
||||
_toggleSwitch: function() {
|
||||
this.options.checked = !this.options.checked;
|
||||
var newLeft = "";
|
||||
if (this.options.checked) {
|
||||
// Update the underlying checkbox state
|
||||
this.element.prop("checked", true);
|
||||
this.element.change();
|
||||
_disableTextSelection: function () {
|
||||
// Elements containing text should be unselectable
|
||||
$([this.$handle, this.$disabledLabel, this.$enabledLabel, this.$container]).attr('unselectable', 'on');
|
||||
},
|
||||
|
||||
var dLeft = this.options.width - this.options.button_width;
|
||||
newLeft = "+=" + dLeft;
|
||||
_autoResize: function () {
|
||||
var onLabelWidth = this.$enabledLabel.width(),
|
||||
offLabelWidth = this.$disabledLabel.width(),
|
||||
spanPadding = this.$disabledSpan.innerWidth() - this.$disabledSpan.width()
|
||||
handleMargins = this.$handle.outerWidth() - this.$handle.innerWidth();
|
||||
|
||||
// Update labels states
|
||||
if(this.options.labels_placement == "both")
|
||||
{
|
||||
this.off_label.removeClass("on").addClass("off");
|
||||
this.on_label.removeClass("off").addClass("on");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.off_label.hide();
|
||||
this.on_label.show();
|
||||
}
|
||||
this.button_bg.addClass("checked");
|
||||
//execute on state callback if its supplied
|
||||
if(typeof this.options.on_callback === 'function') this.options.on_callback.call(this);
|
||||
var containerWidth = handleWidth = (onLabelWidth > offLabelWidth) ? onLabelWidth : offLabelWidth;
|
||||
|
||||
this.$handle.css({ 'width': handleWidth });
|
||||
handleWidth = this.$handle.width();
|
||||
|
||||
containerWidth += handleWidth + 6;
|
||||
spanWidth = containerWidth - handleWidth - spanPadding - handleMargins;
|
||||
|
||||
this.$container.css({ 'width': containerWidth });
|
||||
this.$container.find('span').width(spanWidth);
|
||||
},
|
||||
|
||||
_initialPosition: function () {
|
||||
this.$disabledLabel.css({ width: this.$container.width() - 5 });
|
||||
|
||||
this.rightSide = this.$container.width() - this.$handle.outerWidth();
|
||||
|
||||
if (this.element.prop('checked')) {
|
||||
this.$handle.css({ 'left': this.rightSide });
|
||||
this.$enabledLabel.css({ 'width': this.rightSide });
|
||||
this.$disabledSpan.css({ 'margin-right': -this.rightSide });
|
||||
}
|
||||
else {
|
||||
// Update the underlying checkbox state
|
||||
this.element.prop("checked", false);
|
||||
this.element.change();
|
||||
newLeft = "-1px";
|
||||
this.$enabledLabel.css({ 'width': 0 });
|
||||
this.$enabledSpan.css({ 'margin-left': -this.rightSide });
|
||||
}
|
||||
|
||||
// Update labels states
|
||||
if(this.options.labels_placement == "both")
|
||||
{
|
||||
this.off_label.removeClass("off").addClass("on");
|
||||
this.on_label.removeClass("on").addClass("off");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.off_label.show();
|
||||
this.on_label.hide();
|
||||
}
|
||||
this.button_bg.removeClass("checked");
|
||||
//execute off state callback if its supplied
|
||||
if(typeof this.options.off_callback === 'function') this.options.off_callback.call(this);
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
this.element.prop('disabled', false);
|
||||
this.refresh();
|
||||
return this._setOption('disabled', false);
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
this.element.prop('disabled', true);
|
||||
this.refresh();
|
||||
return this._setOption('disabled', true);
|
||||
},
|
||||
|
||||
widget: function () {
|
||||
return this.$container;
|
||||
},
|
||||
|
||||
refresh: function () {
|
||||
if (this.element.prop('disabled')) {
|
||||
this.$container.addClass(this.options.disabledClass);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
this.$container.removeClass(this.options.disabledClass);
|
||||
}
|
||||
// Animate the switch
|
||||
this.button.animate({ left: newLeft }, 250, "easeInOutCubic");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery, 'switchbutton');
|
||||
|
||||
@@ -1,49 +1,231 @@
|
||||
.switch-button-label {
|
||||
float: left;
|
||||
/**
|
||||
* jQuery switchbutton
|
||||
*
|
||||
* Based on work by tdreyno on iphone-style-checkboxes for events management
|
||||
* (https://github.com/tdreyno/iphone-style-checkboxes)
|
||||
*
|
||||
* Copyright 2011, L.STEVENIN
|
||||
* Released under the MIT license.
|
||||
*/
|
||||
|
||||
font-size: 18px;
|
||||
font-weight: 700;
|
||||
.ui-switchbutton {
|
||||
display: inline-block;
|
||||
padding: 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.ui-switchbutton input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ui-switchbutton label {
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch-button-label.off {
|
||||
color: #9fbcff;
|
||||
}
|
||||
|
||||
.switch-button-label.on {
|
||||
color: #0088CC;
|
||||
}
|
||||
|
||||
.switch-button-background {
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
background: #c6d7ff;
|
||||
background: linear-gradient(to right, #4F4, #4F4, #FAA, #FAA);
|
||||
border: 1px solid #a3bfff;
|
||||
box-shadow: #2d50a1 0px 1px 4px 0px inset;
|
||||
|
||||
margin: 1px 10px;
|
||||
margin-top: 12px;
|
||||
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.switch-button-button {
|
||||
display: block;
|
||||
position: absolute;
|
||||
|
||||
left: -1px;
|
||||
top : -1px;
|
||||
|
||||
background: #FAFAFA;
|
||||
border: 1px solid #a3bfff;
|
||||
|
||||
-webkit-border-radius: 45x;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
box-shadow: #c6d7ff 0px 0px 4px 0px inset;
|
||||
top: 0;
|
||||
width: auto;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.ui-switchbutton label.ui-switchbutton-disabled {
|
||||
right: 0;
|
||||
text-align: right;
|
||||
text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.ui-switchbutton label.ui-switchbutton-disabled span {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
padding-left: 2px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
.ui-switchbutton.ui-switchbutton-no-labels label span {
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
.ui-switchbutton label.ui-switchbutton-enabled {
|
||||
left: 0;
|
||||
text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.ui-switchbutton label.ui-switchbutton-enabled span {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
padding-left: 3px;
|
||||
padding-right: 2px;
|
||||
}
|
||||
|
||||
.ui-switchbutton .ui-switchbutton-handle {
|
||||
display: block;
|
||||
width: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ui-switchbutton.ui-switchbutton-disabled {
|
||||
opacity: 0.4;
|
||||
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
|
||||
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40);
|
||||
filter: Alpha(Opacity=40);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.ui-switchbutton.ui-switchbutton-disabled label,
|
||||
.ui-switchbutton.ui-switchbutton-disabled .ui-switchbutton-handle {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* STYLES
|
||||
*
|
||||
* Styles are composed by a default style which can be overrided by specific classed passed in argument
|
||||
*/
|
||||
|
||||
/* Default style */
|
||||
|
||||
.ui-switchbutton-default {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-default label {
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
font-weight: bold;
|
||||
font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
text-transform: uppercase;
|
||||
height: 20px;
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-default label.ui-switchbutton-disabled {
|
||||
color: #8b8b8b;
|
||||
background: #e2e2e2; /* Old browsers */
|
||||
background: -moz-linear-gradient(top, #7c7c7c 0%, #c5c4c5 25%, #e2e2e2 50%, #efefef 75%, #f8f8f8 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#7c7c7c), color-stop(25%,#c5c4c5), color-stop(50%,#e2e2e2), color-stop(75%,#efefef), color-stop(100%,#f8f8f8)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #7c7c7c 0%,#c5c4c5 25%,#e2e2e2 50%,#efefef 75%,#f8f8f8 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #7c7c7c 0%,#c5c4c5 25%,#e2e2e2 50%,#efefef 75%,#f8f8f8 100%); /* Opera11.10+ */
|
||||
background: -ms-linear-gradient(top, #7c7c7c 0%,#c5c4c5 25%,#e2e2e2 50%,#efefef 75%,#f8f8f8 100%); /* IE10+ */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7c7c7c', endColorstr='#f8f8f8',GradientType=0 ); /* IE6-9 */
|
||||
background: linear-gradient(top, #7c7c7c 0%,#c5c4c5 25%,#e2e2e2 50%,#efefef 75%,#f8f8f8 100%); /* W3C */
|
||||
box-shadow: inset 0px 0px 1px rgba(0, 0, 0, 0.5);
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-default label.ui-switchbutton-enabled {
|
||||
color: white;
|
||||
background: #488fe4; /* Old browsers */
|
||||
background: -moz-linear-gradient(top, #2f63a0 0%, #488fe4 25%, #569aef 49%, #5d9ff2 51%, #77aff8 75%, #86b6f4 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#2f63a0), color-stop(25%,#488fe4), color-stop(49%,#569aef), color-stop(51%,#5d9ff2), color-stop(75%,#77aff8), color-stop(100%,#86b6f4)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #2f63a0 0%,#488fe4 25%,#569aef 49%,#5d9ff2 51%,#77aff8 75%,#86b6f4 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #2f63a0 0%,#488fe4 25%,#569aef 49%,#5d9ff2 51%,#77aff8 75%,#86b6f4 100%); /* Opera11.10+ */
|
||||
background: -ms-linear-gradient(top, #2f63a0 0%,#488fe4 25%,#569aef 49%,#5d9ff2 51%,#77aff8 75%,#86b6f4 100%); /* IE10+ */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2f63a0', endColorstr='#86b6f4',GradientType=0 ); /* IE6-9 */
|
||||
background: linear-gradient(top, #2f63a0 0%,#488fe4 25%,#569aef 49%,#5d9ff2 51%,#77aff8 75%,#86b6f4 100%); /* W3C */
|
||||
box-shadow: inset 0px 0px 1px rgba(0, 0, 0, 0.7);
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-default .ui-switchbutton-handle {
|
||||
height: 22px;
|
||||
background: #f2f2f2; /* Old browsers */
|
||||
background: -moz-linear-gradient(top, #d7d7d7 0%, #fcfcfc 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d7d7d7), color-stop(100%,#fcfcfc)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #d7d7d7 0%,#fcfcfc 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #d7d7d7 0%,#fcfcfc 100%); /* Opera11.10+ */
|
||||
background: -ms-linear-gradient(top, #d7d7d7 0%,#fcfcfc 100%); /* IE10+ */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d7d7d7', endColorstr='#fcfcfc',GradientType=0 ); /* IE6-9 */
|
||||
background: linear-gradient(top, #d7d7d7 0%,#fcfcfc 100%); /* W3C */
|
||||
box-shadow: inset 0px 0px 2px rgba(255, 255, 255, 1);
|
||||
border: 1px solid #a2a2a2;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/* Thin style */
|
||||
|
||||
.ui-switchbutton-thin {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-thin label {
|
||||
font-size: 13px;
|
||||
line-height: 16px;
|
||||
height: 18px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-thin .ui-switchbutton-handle {
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
|
||||
/* iso5 style */
|
||||
|
||||
.ui-switchbutton-ios5 label.ui-switchbutton-disabled {
|
||||
-webkit-border-radius: 12px;
|
||||
-moz-border-radius: 12px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-ios5 label.ui-switchbutton-enabled {
|
||||
-webkit-border-radius: 12px;
|
||||
-moz-border-radius: 12px;
|
||||
border-radius: 12px;
|
||||
-webkit-border-top-right-radius: 0px;
|
||||
-moz-border-radius-topright: 0px;
|
||||
border-top-right-radius: 0px;
|
||||
-webkit-border-bottom-right-radius: 0px;
|
||||
-moz-border-radius-bottomright: 0px;
|
||||
border-bottom-right-radius: 0px;
|
||||
}
|
||||
|
||||
|
||||
.ui-switchbutton-ios5 label.ui-switchbutton-enabled {
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-ios5.ui-state-active label.ui-switchbutton-enabled {
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.ui-switchbutton-ios5 .ui-switchbutton-handle {
|
||||
height: 22px;
|
||||
width: 22px !important;
|
||||
-webkit-border-radius: 12px;
|
||||
-moz-border-radius: 12px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
|
||||
/* Force sizes */
|
||||
/*
|
||||
.ui-switchbutton {
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
.ui-switchbutton .ui-switchbutton-handle {
|
||||
width: 20px;
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user