我有 2 页并尝试水平滚动它们。但是页面宽度没有跨越。第 2 页可见。如何解决这个问题?
小提琴:http: //jsfiddle.net/x8WVe/
HTML:
<section class="section span12" id="section1">
<header>
<div class="main-header">
<a href="#" alt="My Logo"><span class="get">My Logo</a>
</div>
</header>
<div class="content-wrapper span10">
<div class="sub-headline span8">
<h2>sfdhgsafdhasgh</h2>
<small>dshgfgdsjhgfgfjhdgsfdjgdf</small>
</div>
<div class="inner span8">
<p>
ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf
</p>
<a href="#" class="btn" id="click" alt="click" aria-label="click" tab-index="-1">Click</a>
</div>
<a class="nav-slide next" href="#section2">›</a>
</div>
</section>
<section class="section span12" id="section2">
<header>
<div class="main-header">
<a href="#" alt="My Logo">My Logo</a>
</div>
</header>
<div class="content-wrapper span10">
<div class="sub-headline span8">
<h2>sfdhgsafdhasgh</h2>
<small>dshgfgdsjhgfgfjhdgsfdjgdf</small>
</div>
<div class="inner span8">
<p>
ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>ewtytrfjwhbfhshgfeyjrgf<br>
</p>
<a href="#" class="btn" id="click" alt="click" aria-label="click" tab-index="-1">Click</a>
</div>
<a class="nav-slide prev" href="#section2">‹</a>
</div>
</section>
CSS:
body{
font-family:Georgia;
font-size: 34px;
font-style: italic;
letter-spacing:-1px;
width:12000px;
position:absolute;
top:0px;
left:0px;
bottom:0px;
}
/*Page Styles*/
/*header*/
header {
background-color: #fdfdfd;
-webkit-box-shadow: 0px 2px 4px rgba(0,0,0,0.4);
-moz-box-shadow: 0px 2px 4px rgba(0,0,0,0.4);
box-shadow: 0px 2px 4px rgba(0,0,0,0.4);
border-bottom-color: transparent;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
height: 7%;
}
.section{
margin:0px;
bottom:0px;
float:left;
height:100%;
text-shadow:1px 1px 2px #f0f0f0;
}
.section h2{
margin:50px 0px 30px 50px;
}
.section p{
margin:20px 0px 0px 50px;
width:600px;
}
.section#section1 {
background-color: #48a95e;
}
.section#section2{
background-color: #C6FFC8;
}
.section ul{
list-style:none;
margin:20px 0px 0px 550px;
}
.content-wrapper {
border: 1px solid red;
position: relative;
top: 20%;
text-align: center;
}
/*Slide Nav Button*/
.nav-slide {
position: relative;
top: 13%;
vertical-align: middle;
}
.prev {
float: left;
}
.next {
float: right;
}
JS:
$(function() {
$('a.next').bind('click',function(event){
var $anchor = $(this);
/*
if you want to use one of the easing effects:
$('html, body').stop().animate({
scrollLeft: $($anchor.attr('href')).offset().left
}, 1500,'easeInOutExpo');
*/
$('html, body').stop().animate({
scrollLeft: $($anchor.attr('href')).offset().left
}, 1000);
event.preventDefault();
});
$('a.prev').bind('click',function(event){
var $anchor = $(this);
$('html, body').stop().animate({
scrollLeft: $($anchor.attr('href')).offset().left
}, 1000);
event.preventDefault();
});
});