When the body is empty, the scroll bar is not needed, but if the body is full with content, the scroll bar is necessary. How can I know the scroll bar is there or not without any JQuery Libs be using? I try to change my page dynamically. The problem is I have to adapt my layout with scroll bar. Thanks! My code is below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb" >
<head>
<meta content="width=device-width, initial-scale=1.0, user-scalable=no" name="viewport" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
</title>
<style type="text/css">
body
{
margin:0px;
padding:0px;
border:0px;
/* border-color:#FEFEFE;*/
/* background-image:url(bg.png);*/
background-repeat: repeat;
display:block;
z-index:-9999;
width:100%;
height:100%;
left:0px;
top:0px;
}
div
{
background-color:#a0a0a0;
position:absolute;
left:0px;
top:0px;
width:100%;
height:100%;
display:block;
z-index:-8888;
}
</style>
</head>
<body id="body">
<div id="bg">
<span id="s1">
test
</span>
</div>
</body>
<script type="text/javascript">
(function (d) {
setInterval(function () {
w = d.body.clientWidth;
h = window.innerHeight;
document.title = w + " : " + h;
}, 1);
})(document)
</script>
</html>
Aucun commentaire:
Enregistrer un commentaire