<div class="content">
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
<p>5</p>
<p>6</p>
<p>7</p>
<p>8</p>
<p>9</p>
<p>10</p>
<p>11</p>
<p>12</p>
<div class="fix_box">
<div class="switch"></div>
</div>
</div>
*{margin:0px; padding:0px;}
.content p{line-height:80px;font-size:20px;}
.content{
width:1000px;
height:1500px;
margin:0 auto;
background:#6FF;
}
.fix_box{
width:300px;
height:100px;
background:#FFC;
position:fixed;
top:100px;
left:-270px;
*position:absolute;
}
.switch{
width:30px;
height:100px;
background:url(cc.gif) no-repeat;
cursor:pointer;
margin-left:270px;
}
$(document).ready(function(){
$(".switch").toggle(function(){
var _left =0;/*($(window).width() - 960) / 2;*///距离左边的距离
$('.fix_box').animate({left: _left + 'px'});
$('.switch').css("background","url(ca.gif)");
},function(){
$('.fix_box').animate({left: "-270px"});
$('.switch').css("background","url(cc.gif)");
})
})
[img]http://dl2.iteye.com/upload/attachment/0087/5813/665bd823-659c-3cd4-a4ee-2cab106fc105.gif[/img]
[img]http://dl2.iteye.com/upload/attachment/0087/5815/54f01262-a633-3091-8d0c-535d6f029e1b.gif[/img]