Sha256: 28501d79240d57da92dcf55e9c8b36e9e289ef0d0b76a015ca6e565320b08fa0

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

$(document).on 'change', '[data-toggle=cards] input[type=radio]', (event) ->
  $input = $(event.currentTarget)
  return unless $input.is(':checked')

  $card = $input.closest('.card')
  return unless $card.length > 0

  $cards = $input.closest('.card-deck').children('.card')
  return unless $cards.length > 0

  $cards.removeClass('active').removeClass('border-secondary')
  $cards.find('.card-header').removeClass('bg-secondary text-white')

  $card.addClass('active').addClass('border-secondary')
  $card.find('.card-header').addClass('bg-secondary text-white')
  true

$(document).on 'click', '[data-toggle=cards] [data-toggle=card]', (event) ->
  $card = $(event.currentTarget).closest('.card')
  return unless $card.length > 0

  val = $card.find('input:radio').val()
  $card.find('input:radio').val([val]).trigger('change')
  false

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_bootstrap-0.0.7 app/assets/javascripts/effective_radio/initialize.js.coffee