Hello,
i searched around the web, but can't find right peace of codes..
I want to do: - go to Fullscreen mode on a button click. - change a background color to dark and save it as cookies.
Fullscreen mode:
i'm new with jQuery and can't find a right code. I found one, but when i click on button to next page, it turn's off the full screen mode to normal browser window, and changes my website background colors.
Founded code:
<html>
<head>
<title>TEST</title>
</head>
<body>
<a href="#" title="Go Fullscreen" onclick="toggleFullScreen()"><img src="fullscreen.png"></a>
<script>
function toggleFullScreen() {
if ((document.fullScreenElement && document.fullScreenElement !== null) ||
(!document.mozFullScreen && !document.webkitIsFullScreen)) {
if (document.documentElement.requestFullScreen) {
document.documentElement.requestFullScreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullScreen) {
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.cancelFullScreen) {
document.cancelFullScreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitCancelFullScreen) {
document.webkitCancelFullScreen();
}
}
}
</script>
</body>
</html>
Change Background and save as Cookies:
I want to do, that a members chooses on radio button's a theme White or Dark. The White theme default <div>
background is white #fff(White). When member chooses the Dark theme, it changes <div>
background to #000000(Black) color. I'm new and can't write a code, without examples or something. Can someone tell me, how can i do it with Cookies and Javascript/jQuery?
Members settings page to change it:
<html>
<head>
<title>Settings</title>
</head>
<body>
<p>Change Theme</p>
<form>
<input type="radio" id="Light" title="White Theme">
<br />
<input type="radio" id="Dark" title="Dark theme">
<br />
<input type="submit" id="submit" value="Submit">
</form>
</body>
</html>
Page BEFORE changes the Theme to Dark:
<html>
<head>
<title>Home Page</title>
</head>
<body>
<div style="background:#fff;height:600px;width:100%;">
<!-- SOME CONTENT -->
</div>
</body>
</html>
and Page AFTER changes the Theme to Dark:
<html>
<head>
<title>Home Page</title>
</head>
<body>
<div style="background:#000000;height:600px;width:100%;">
<!-- SOME CONTENT -->
</div>
</body>
</html>
Thanks!