I need to create layout like this
It is not scrolling smoothly.
I need to travel to 2nd div each time before going to div clicked by navigation
My full code is here
css
@import url("reset.css");
html, body{
height:100%;
width:100%;
margin:0;
overflow:hidden;
background:url(images/4.png) repeat center top;
color:#FFFFFF;
}
a{color:#FFFFFF}
#header{float:left; width:100%; background:#009999; top:0px; height:75px; position:fixed; display:block; z-index:1}
#navigation{float:right; width:45%;}
#nav{
position:fixed;
float:right;
clear:both;
width:100%;
z-index:5;
}
#nav li{
float:left;
position:relative;
margin:0 0 0 16px;
cursor:pointer;
padding:10px;
}
#container{margin:75px auto 0 auto; width:90%; background:#999966; }
.slidingSpaces{ margin:auto; position:absolute}
#contentliquid{ padding:15px; }
#div1{position:absolute;width:100%;background:#0099CC; margin:0 0 0 100%; }
#div2{position:absolute;width:100%;background:#993300; margin:0 0 0 0; }
#div3{position:absolute;width:100%;background:#99FF33; margin:0 0 0 200%; }
#div4{position:absolute;width:100%;background:#00CCFF; margin:100% 0 0 200%; }
#div5{position:absolute;width:100%;background:#FFCCCC; margin:100% 0 0 100%; }
#div6{position:absolute;width:100%;background:#FFFFCC; margin:100% 0 0 0; }
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>jQuery ScrollTo - Smooth Scrolling to any jQuery/DOM Element</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.scrollto.js"></script>
<script type="text/javascript" src="js/script.js"></script>
</head>
<body>
<div id="wrapper">
<div id="header">
<div id="logo">Logo</div>
<div id="navigation">
<ul id="nav">
<li><a href="#div1" class="slidingLink">Div 1</a></li>
<li><a href="#div2" class="slidingLink">Div 2</a></li>
<li><a href="#div3" class="slidingLink">Div 3</a></li>
<li><a href="#div4" class="slidingLink">Div 4</a></li>
<li><a href="#div5" class="slidingLink">Div 5</a></li>
<li><a href="#div6" class="slidingLink">Div 6</a></li>
</ul>
</div>
</div>
<div id="div1" class="slidingSpaces" title="Home">
<div id="container">
<div id="contentliquid">
<h1>This is div1</h1>
</div>
</div>
</div>
<div id="div2" class="slidingSpaces" title="Home">
<div id="container">
<div id="contentliquid">
<h1>This is div2</h1>
</div>
<div id="footer">
<p>This is the Footer</p>
</div>
</div>
</div>
<div id="div3" class="slidingSpaces" title="Product">
<div id="container">
<div id="contentliquid">
<h1>This is div3</h1>
</div>
</div>
</div>
<div id="div4" class="slidingSpaces" title="Space">
<div id="container">
<div id="contentliquid">
<h1>This is div4</h1>
</div>
</div>
</div>
<div id="div5" class="slidingSpaces" title="Enquiry">
<div id="container">
<div id="contentliquid">
<h1>This is div5</h1>
</div>
</div>
</div>
<div id="div6" class="slidingSpaces" title="Contact">
<div id="container">
<div id="contentliquid">
<h1>This is div6</h1>
</div>
</div>
</div>
</div>
</body>
</html>
script.js
$(document).ready(function() {
var bodyheight =$(window).height();
$(".slidingSpaces").css({'height':bodyheight});
$("#nav li a").click(function() {
var linked=$(this).attr("href");
$(linked).ScrollTo({duration: 800});
});
});