Created
February 1, 2017 12:01
-
-
Save antiden/94cf99b8c46773162ce8fa3542e7f28f to your computer and use it in GitHub Desktop.
Count elements and add Classes
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
/*Count*/ | |
var $this = $('.page_content__content .menu > li'); | |
if ($this.length == 1) { | |
$this.addClass('one'); | |
} else if ($this.length == 2) { | |
$this.addClass('two'); | |
} else if ($this.length == 3) { | |
$this.addClass('three'); | |
} else if ($this.length == 4) { | |
$this.addClass('four'); | |
} else if ($this.length == 5) { | |
$this.addClass('five'); | |
} else if ($this.length == 6) { | |
$this.addClass('six'); | |
} else if ($this.length == 7) { | |
$this.addClass('seven'); | |
} else if ($this.length == 8) { | |
$this.addClass('eight'); | |
} else if ($this.length == 9) { | |
$this.addClass('nine'); | |
} else if ($this.length == 10) { | |
$this.addClass('ten'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment