Sha256: cd78a14f12c6f5b6d07f1bc5bed8abe651b531bd7da932869224dbdb7c3e9759

Contents?: true

Size: 646 Bytes

Versions: 6

Compression:

Stored size: 646 Bytes

Contents

var toggleHandler = function(toggle) {
    var toggle = toggle;
    var radio = $(toggle).find("input");

    var checkToggleState = function() {
        if (radio.eq(0).is(":checked")) {
            $(toggle).removeClass("toggle-off");
        } else {
            $(toggle).addClass("toggle-off");
        }
    };

    checkToggleState();

    radio.eq(0).click(function() {
        $(toggle).toggleClass("toggle-off");
    });

    radio.eq(1).click(function() {
        $(toggle).toggleClass("toggle-off");
    });
};

$(document).ready(function() {
    $(".toggle").each(function(index, toggle) {
        toggleHandler(toggle);
    });
});

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
rails_admin_glyph_theme-0.0.2 vendor/assets/javascripts/rails_admin_glyph_theme/lib/custom_radio.js
hashup-0.0.5 lib/hashup/templates/themes/static/js/custom_radio.js
flatui-rails-0.0.4 vendor/assets/javascripts/custom_radio.js
flatui-0.0.1 vendor/assets/javascripts/custom_radio.js
flatui-rails-0.0.3 vendor/assets/javascripts/custom_radio.js
flatui-rails-0.0.2 vendor/assets/javascripts/custom_radio.js