<html>
<head>
<script src="http://wcetdesigns.com/assets/javascript/jquery.js"></script>
<script>
window.onscroll
= z;
window.onload
= z;
window.onresize
= z;
function z
(){
var ww
= window.innerWidth;
//WINDOW WIDTH
var wh
= window.innerHeight;
//WINDOW HEIGHT
var hw
= $
(".header").width
();
//HEADER WIDTH
var hh
= $
(".header").height
();
//HEADER HEIGHT
var o
= window.pageYOffset;
//OFFSET OF THE WINDOW
//IF THE PAGE IS SCROLLED TO WHERE THE HEADER WOULD BE INVISIBLE
if(o
>hh){
//IF WINDOW WIDTH > HEADER WIDTH
if(ww
>hw){
$(".header").css({"position":"fixed", "top":"0"});
var hw = $(".header").width(); //SETS ITS OWN WIDTH INSTEAD OF THAT OF THE WINDOW
$(".header").css({"width":hw+"px"});
}
else {
$(".header").css({"position":"static"});
}
}
else {
$(".header").css({"position":"static"});
}
}
</script>
</head>
<body>
<div class="header">
<img src="http://images.wcetdesigns.com/banners/MiniBanner.png">
</div>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
Scroll down for the demo...
<br>
</body>
</html>