Would it be possible for me to create a glass effect using the method I made below and apply it to a containing div that’s width and height are 100%? This would mean that no matter how you resize the window, the corners of the glass div always move with the window.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" media="screen">
body {
margin: 0;
padding: 0;
background: #eee;
}
#container {
width: 500px;
height: 500px;
position: absolute;
top: 200px;
margin-left: -250px;
left: 50%;
background: #333;
}
#container .glass {
position: absolute;
width: 710px;
height: 710px;
top: -355px;
left: -355px;
background: #fff;
opacity: 0.1;
-webkit-transform:rotate(45deg);
}
</style>
</head>
<body>
<div id="container">
<div class="glass"></div>
</div>
</body>
</html>
This fiddle I think does what you desire. I set the resize event on a timer, so it does not automatically follow instantly on a resizing. You could change that if it is important, but it helps to not use as much processing power to only check every so often for a resize.
Here’s the code (HTML as you have above):
CSS
Javacript (JQuery)