Sha256: d4dfae3121da7d6a522f941ec23b9c3d735eb67f80cfb7a617fb1236bfcc3564
Contents?: true
Size: 980 Bytes
Versions: 5
Compression:
Stored size: 980 Bytes
Contents
(($, window) -> class DropdownSelectInput defaults: {} constructor: ($el, options) -> @options = $.extend({}, @defaults, options) @$el = $el @$input = $el.find('input') @$toggle = $el.find('.dropdown_toggle_button') @$el.on 'click', 'a[data-value]', (e) => $a = $(e.currentTarget) @$input.val($a.data('value')) .trigger('input') .trigger('change') $a.closest('li') .addClass('active') .siblings() .removeClass('active') @$toggle.text($a.find('.drop_rich_head').text()) $.fn.extend dropdownSelectInput: (option, args...) -> @each -> data = $(@).data('dropdown-select-input') if !data $(@).data 'dropdown-select-input', (data = new DropdownSelectInput($(@), option)) if typeof option == 'string' data[option].apply(data, args) ) window.jQuery, window $ -> $(".dropdown_rich").dropdownSelectInput()
Version data entries
5 entries across 5 versions & 1 rubygems