<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
body {
margin:0;
}
#hid{
width: 100%;
height: 50px;
background: #FF0000;
opacity: 1;
position: fixed;
top:-50px;
}
body{
height: 3000px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(window).scroll(function(){
var bo = $(this).scrollTop();
var a = $("#hid").css('top')
$("#hid").html(bo);
if ( bo >= 200) {$("#hid").animate({'top':'500px'},2000)};
if ( bo < 200) {$("#hid").animate({'top':'-500px'},2000)};
})
})
</script>
</head>
<body>
<div id="hid">
</div>
</body>
</html>