Sha256: 09f82b218d86c9d98bdfe5aa372fd1bfd8a682ad80e90e8ce8e983a29148e444

Contents?: true

Size: 658 Bytes

Versions: 12

Compression:

Stored size: 658 Bytes

Contents

window.RadioToggle = (function() {
  var defaults = {
    $target: $(".us-toggle")
  };

  function RadioToggle(options) {
    this.options = Utils.setOptions(options, defaults);
    if (this.options.$target) {
      this.addEventListeners();
    } else {
      throw new Error("No target defined");
    }
  }

  RadioToggle.prototype.addEventListeners = function() {
    return this.options.$target.on("change", "input:radio", function(e) {
      $("input[name='" + this.name + "']").removeClass("checked");
      if (this.checked) {
        $(this).addClass("checked");
      }

      return e.stopPropagation();
    });
  };

  return RadioToggle;

})();

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ustyle-1.11.1 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.10.0 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.8.7 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.8.1 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.8.0 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.7.0 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.6.1 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.5.8 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.4.1 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.4.0 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.3.12 vendor/assets/javascripts/ustyle/radioToggle.js
ustyle-1.3.6 vendor/assets/javascripts/ustyle/radioToggle.js