The following js code allows me, with buttons, to dynamically change color to the body class, it works great.
However, in addition to backgroundColor I have tried to use other CSS rules, for example color, borderColor, on a button, and it works very well.
1) If I use box-shadow or boxShadow does not seem to work. Am I wrong or is there a list of CSS rules I can use?
2) $('h2').css('backgroundColor', '#000'); to get a change of color on mouse over I tried $('h2:hover').css('backgroundColor', '#ff0000'); but this does not work. Also in this case the reason is that dynamically you cannot use: hover? Or am I wrong?
$(document).ready(function () {
var nightMode = function() {
$('body').css('backgroundColor', '#000');
},
normalMode = function() {
$('body').css('backgroundColor', '#fff');
};
$("#night-mode").click(function () {
localStorage.setItem('modalread', 'night-mode');
nightMode();
});
$("#normal-mode").click(function () {
localStorage.setItem('modalread', 'normal-mode');
normalMode();
});
if (localStorage.getItem('modalread') == 'normal-mode') {
normalMode();
} else if (localStorage.getItem('modalread') == 'night-mode') {
nightMode();
}
});
If I use box-shadow or boxShadow does not seem to workwhat doesn't work? how do you try to use it?$('h2:hover')- unfortunately that's not how jQuery workshoverjquery has a method calledhover(). CHeck it out.