Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea check the client width of a known Element #53

Open
Drtikso opened this issue Sep 3, 2014 · 1 comment
Open

Idea check the client width of a known Element #53

Drtikso opened this issue Sep 3, 2014 · 1 comment

Comments

@Drtikso
Copy link

Drtikso commented Sep 3, 2014

Has anyone thought of this?

<div id="test">H</div><br/>
<div id="content" style="background-color:cyan; width:50%;">BLAH<div/>
</body>
<script>
function work(){
var w = screen.width;
var content = document.getElementById("content");
var width = content.clientWidth;
var height = content.clientHeight;
document.getElementById("test").innerHTML = width + " " + height + " " + w;
}
setInterval(work,60);
</script>

var w doesn't change it's value when the page is zoomed.
var width changes.

Some Maths and voila 😄

@curiousercreative
Copy link

unfortunately, screen.width updates as you zoom in Firefox for one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants