Created
October 7, 2014 13:45
-
-
Save dacur/7da1d3660b75f1072ab1 to your computer and use it in GitHub Desktop.
Iterating over child elements to determine if an element does NOT have a certain class. Child element icons have a default class of 'opacity50' that makes them grey instead of black. When clicked, that class is removed, making the selected icon black. Uses Font Awesome icons.
This file contains hidden or 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
| function JournalScale(){ | |
| $('#journalScale').children('i').each(function(){ | |
| if(!$(this).hasClass('opacity50')){ | |
| _smileySelected = (this).id; | |
| } | |
| }); | |
| } |
This file contains hidden or 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
| .opacity50 { opacity: 0.5; } |
This file contains hidden or 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
| #journalScale | |
| i.fa.fa-smile-o.fa-3x.opacity50.journalFeeling#journalSmile | |
| i.fa.fa-meh-o.fa-3x.opacity50.journalFeeling#journalMeh | |
| i.fa.fa-frown-o.fa-3x.opacity50.journalFeeling#journalFrown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment