I am currently working on incorporating a sliding horizontal layout with a header banner.
Here is the HTML structure I am using:
<body>
<div id="header">
<div><a href="#one"> one </a></div>
<div><a href="#two"> two </a></div>
<div><a href="#thr"> thr </a></div>
</div>
<div id="one" class="panel"> </div>
<div id="two" class="panel"> </div>
<div id="thr" class="panel"> </div>
</body>
The header remains fixed, and the panels have been designed with a gradient background (the middle panel has a different color for debugging purposes). Here is the CSS styling being used:
body {
width: 6000px;
overflow: hidden;
}
.panel {
width: 33.3%;
float: left;
padding-left: 30px;
padding-right: 1040px;
margin-top: -75px;
height: 960px;
background-image: linear-gradient(to bottom, #0B88FF, #95EEFF);
}
#header {
position: fixed;
height: 75px;
margin-top: 25px;
}
#two{
background-image: linear-gradient(to bottom, #0B8800, #9E5EFF);
}
Additionally, I have a function in place to handle the animation between panels:
$(document).ready(function() {
$("#header a").bind("click", function(event) {
event.preventDefault();
var target = $(this).attr("href");
$("html, body").stop().animate({
scrollLeft: $(target).offset().left,
scrollTop: $(target).offset().top
}, 1200);
});
});
However, I am encountering a few issues that need troubleshooting:
1) I have attempted to implement a jQuery function for a slide animation triggered by the mouse wheel, but my tests have not been successful...I am consistently encountering the same issue:
$(window).scroll(function() {
if ($(this).scrollTop() > 0) {
var target // I am still unable to determine the appropriate target
$("html, body").stop().animate({
//should be moving towards the target >,<
}
});
2) The layout appears to function correctly when my browser window is at 100% size, but adjusting the zoom causes everything to become disordered >,< I am aware that this can be resolved, and I found an example showcasing the solution: here is the link