Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:09:34+00:00 2026-06-03T03:09:34+00:00

Would it be possible for me to create a glass effect using the method

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:09:35+00:00Added an answer on June 3, 2026 at 3:09 am

    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

    html {
        height: 100%;
    }
    
    body {
        margin: 0;
        padding: 0;
        background: #eee;
        height: 100%;
    }
    
    #container {
        width: 100%;
        height: 100%;
        position: absolute;
        background: #333;
        overflow: hidden;
    }
    
    #container .glass {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        background: #fff;
        opacity: 0.1;
        -webkit-transform-origin: 0 100% ;
        -moz-transform-origin: 0 100%;
        -ms-transform-origin: 0 100%;
        -o-transform-origin: 0 100%;
        transform-origin: 0 100%;
    }
    

    Javacript (JQuery)

    function glassIt() {
    
        var g = $(".glass");
        var c = g.parent();
        var w = c.width();
        var h = c.height();
        var ext = ["-webkit-", "-moz-", "-o-", "-ms-"];
        var angle = "rotate("+(-1 * ((Math.atan(h/w))/(2*Math.PI))*360)+"deg)";
    
        g.width(Math.sqrt(Math.pow(w,2)+Math.pow(h,2)));
    
        for(i = 0; i <= ext.length; i++) {
            if(i < ext.length) {
                g.css(ext[i]+"transform", angle);
            }
            else {
                g.css("transform", angle);
            }
        }
    }
    
    var resizeTimer;
    $(window).resize(function() {
        clearTimeout(resizeTimer);
        resizeTimer = setTimeout(glassIt, 100);
    });
    
    $(document).ready(function() {
      glassIt();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to create a program using AS3 that would allow the user
In Xcode, would it be possible to create a method that generates a run
Possible Duplicate: JavaScript library to create div-style window within page I would like to
Would it be possible to create a python Pool that is non-daemonic? I want
Would it be possible to create a modal dialog box with DialogBox(Param) that blocks
Would it be possible to create a custom JMenuItem that contains buttons? For example
I was wondering if it would be possible to create a window using SWT
Would it be possible to create a TextView in Android that can scroll many
Since Rails is using Ruby (dynamic language), would it be possible to create a
How would you / or is it possible to create an animation in css3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.