Created
February 20, 2014 22:45
-
-
Save jpetto/9124867 to your computer and use it in GitHub Desktop.
CW: Theme Switcher - starter JS
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($) { | |
'use strict'; | |
var $body = $('body'); | |
var $theme_list = $('#theme-list'); | |
var $theme_bar = $('#theme-bar'); | |
var themes = ['risky', 'rooftop', 'specter']; | |
var current_theme = themes[0]; | |
var $theme_li, $theme_a; | |
for (var i = 0; i < themes.length; i++) { | |
$theme_li = $('<li>'); | |
$theme_li.addClass('inline-item'); | |
$theme_a = $('<a>'); | |
$theme_a.attr('href', '#'); | |
$theme_a.data('theme', themes[i]); | |
$theme_a.addClass('theme-link'); | |
$theme_a.text(themes[i]); | |
if (i === 0) { | |
$theme_a.addClass('selected'); | |
} | |
$theme_li.append($theme_a); | |
$theme_list.append($theme_li); | |
} | |
})(window.jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment