DevelopPHP
home Forum gear home

Libraries book

HTML Library CSS Library JavaScript Library PHP Library

Videosbook

PHP and MySQL JavaScript HTML and CSS Vector and 3D Flash Actionscript Android Dev Miscellaneous

Resourcesbook

Website Hosting
<iframe width="560" height="315" src="http://www.youtube.com/embed/waM7rRqIiVE" frameborder="0" allowfullscreen></iframe>
You can embed this video on your blog or web page by copying the video embed code above and pasting it into the source code of your page. Adjust the width and height to specify the size you would like it to display.
Thumb Web Page Theatre Mode Overlay Tutorial CSS Javascript Light Switch Toggle Darkness
Embed Source - http://www.youtube.com/watch?v=waM7rRqIiVE
Publish Date - Jun 14, 2012     Author - Adam Khoury
Web Page Theatre Mode Overlay Tutorial CSS Javascript Light Switch Toggle Darkness
Learn to program web page theatre mode darkness using a CSS and JavaScript overlay. This one uses a light switch as the user interface to allow a viewer to toggle the page in and out of theatre mode. Our elements and their CSS are structured a little bit differently to focus on an existing special content box on the page as opposed to bringing a new DIV into the center of the page. Stemming off of our earlier overlay tutorial: http://www.developphp.com/view.php?tid=1254
Lesson Code
<!-- Example by Adam Khoury @ www.developphp.com -->
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
div#overlay {
display:none;
z-index: 2;
background:url(style/opaqueDark.png);
position:fixed;
width:100%;
height:100%;
top:0px;
left:0px;
text-align:center;
}
img#lightSwitch {
position:relative;
z-index: 3;
background:url(images/light_switch_down.jpg) no-repeat;
cursor:pointer;
}
div#special {
position:relative;
z-index: 4;
}
</style>
<script type="text/javascript">
function toggleTheatreMode(){
var overlay = document.getElementById('overlay');
var lightSwitch = document.getElementById('lightSwitch');
if(overlay.style.display == "block"){
overlay.style.display = "none";
lightSwitch.src = "images/light_switch_up.jpg";
lightSwitch.title = "Enter Theatre Mode";
} else {
overlay.style.display = "block";
lightSwitch.src = "images/light_switch_down.jpg";
lightSwitch.title = "Exit Theatre Mode";
}
}
</script>
</head>
<body>
<!-- Start Overlay -->
<div id="overlay"></div>
<!-- End Overlay -->
<h1>Web page theatre mode example</h1>
<img id="lightSwitch" onmousedown="toggleTheatreMode()" src="images/light_switch_up.jpg" width="19" height="46" alt="switch" title="Enter Theatre Mode"> <h3 style="display:inline;">I can put a title here if I want</h3>
<div id="special">
  <iframe width="560" height="315" src="http://www.youtube.com/embed/69-R9GHcGWU" frameborder="0" allowfullscreen></iframe>
</div>
<h2>My web page has a lot off stuff on it</h2>
</body>
</html>

Home   •   Terms of Use   •   Developer Forums   •   T-Shirts   •   RSS   •   Classroom Chalkboard   •   Donate   •   Top ↑
Popular In PHP / MySQL E-Commerce Store Production
Social Network Website Building
Image Upload / Photo Processing
CMS Software Programming
Mass Email Systems
Magic XML Data
Search Programming
Popular In JavaScript JSON Programming
Ajax Programming
Animating Elements
WYSIWYG Programming
Date/Time Programming
DOM Scripting
Object Reference
Popular In HTML Canvas Element
New Form Elements
Audio Element
Video Element
Drag and Drop
Event Handling
Element Grouping
Popular In CSS Custom Font Embedding
Dynamic Fit Backgrounds
Theatre Mode
Box Overlays
CSS Level 1 Properties
CSS Level 2 Properties
CSS Level 3 Properties
©2013 DevelopPHP   |   Navigate to related domains HTML5