Sha256: 76825904c9476ebd7877dcf4deadad84f41884c1972614f51bb9e79c8d9f6e6b

Contents?: true

Size: 1.47 KB

Versions: 58

Compression:

Stored size: 1.47 KB

Contents

/*! UIkit 2.10.0 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */

(function(addon) {

    var component;

    if (jQuery && jQuery.UIkit) {
        component = addon(jQuery, jQuery.UIkit);
    }

    if (typeof define == "function" && define.amd) {
        define("uikit-form-select", ["uikit"], function(){
            return component || addon(jQuery, jQuery.UIkit);
        });
    }

})(function($, UI){

    UI.component('formSelect', {
        defaults: {
            'target': '>span:first'
        },

        init: function() {
            var $this = this;

            this.target  = this.find(this.options.target);
            this.select  = this.find('select');

            // init + on change event
            this.select.on("change", (function(){

                var select = $this.select[0], fn = function(){

                    try {
                        $this.target.text(select.options[select.selectedIndex].text);
                    } catch(e) {}

                    return fn;
                };

                return fn();
            })());

            this.element.data("formSelect", this);
        }
    });

    // init code
    UI.ready(function(context) {

        $("[data-uk-form-select]", context).each(function(){
            var ele = $(this);

            if (!ele.data("formSelect")) {
                var obj = UI.formSelect(ele, UI.Utils.options(ele.attr("data-uk-form-select")));
            }
        });
    });

    return UI.formSelect;
});

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
kuppayam-0.2.12.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.11.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.10.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.9.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.8.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.7.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.6.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.5.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.4.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.3.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.2.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.1.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.2.0.pre.materialize vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.39 vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.38 vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.37 vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.36 vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.35 vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.34 vendor/assets/javascripts/uikit/js/addons/form-select.js
kuppayam-0.1.33 vendor/assets/javascripts/uikit/js/addons/form-select.js