Switch is a Grid-compatible Field Type add-on for ExpressionEngine that enables easy either-or switches.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
system/expressionengine/third_party/switch
themes/third_party/switch
LICENSE.md
README.md

README.md

Switch

Switch is a Grid-compatible Field Type add-on for ExpressionEngine that enables easy either-or switches.

A note about support

While we have incentive to keep this project working because we use it frequently, we are not always available to provide support for the Switch plugin. We therefore offer it to you, free of charge, but with no guarantee of support. Find something that's not working? Or could be improved? By all means, fix it! Submit a pull request, and we'll pull it into the project so everyone can benefit. But please, no hard feelings if we can't help you when it's not working. Go forth and Open Source.

Requirements

  • EE 2.7

Installation

  1. Copy the "system/expressionengine/third_party/switch" folder to ExpressionEngine's third-party add-ons directory. (e.g. /system/expressionengine/third_party/)
  2. Copy the "themes/third_party/switch" folder to ExpressionEngine's third- party themes directory. (e.g. /themes/third_party/switch/)
  3. Log into your ExpressionEngine control panel.
  4. Open the Field Types tab.
  5. Click "Install" by "Switch".

Usage

Set "Switch" as the Field Type.

Events

Each Switch field will trigger a custom jQuery event when the user changes the value.

$('#hold_field_7 .switch').on('switchChange', function(e) {
	var position = e.switchPosition; // The position of the option (1, 2, ..., 8)
	var value = e.switchValue; // The selected option's value
	var text = e.switchText; // The selected option's text
	var color = e.switchColor; // The selected option's color
});

License

Switch is distributed under the MIT license. See LICENSE.md for more information.