patashala/style/bower_components/styleswitcher/jQuery.style.switcher.js

52 lines
1.4 KiB
JavaScript
Raw Normal View History

// Theme color settings
$(document).ready(function(){
function store(name, val) {
if (typeof (Storage) !== "undefined") {
localStorage.setItem(name, val);
} else {
window.alert('Please use a modern browser to properly view this template!');
}
}
$("*[theme]").click(function(e){
e.preventDefault();
var currentStyle = $(this).attr('theme');
store('theme', currentStyle);
$('#theme').attr({href: 'css/colors/'+currentStyle+'.css'})
});
var currentTheme = get('theme');
if(currentTheme)
{
$('#theme').attr({href: 'css/colors/'+currentTheme+'.css'});
}
// color selector
$('#themecolors').on('click', 'a', function(){
$('#themecolors li a').removeClass('working');
$(this).addClass('working')
});
});
function get(name) {
}
$(document).ready(function(){
$("*[theme]").click(function(e){
e.preventDefault();
var currentStyle = $(this).attr('theme');
store('theme', currentStyle);
$('#theme').attr({href: 'css/colors/'+currentStyle+'.css'})
});
var currentTheme = get('theme');
if(currentTheme)
{
$('#theme').attr({href: 'css/colors/'+currentTheme+'.css'});
}
// color selector
$('#themecolors').on('click', 'a', function(){
$('#themecolors li a').removeClass('working');
$(this).addClass('working')
});
});