Created
April 2, 2014 23:03
This bit of coffee handles the card finder style changes on http://creditcardreviews.com/. I used data attributes to define the card type for each button. This code updates the button and illustration styles when a user chooses a type of card to search for. It also updates the hidden 'type' field to send this information when the form is submitted.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.find-cards form a.button').click -> | |
$this = $ this | |
$this.addClass('active').siblings().removeClass 'active' | |
$('.types').removeClass('personal business student').addClass($this.data('type')) | |
$('#type').val $this.data('slug') | |
false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment