【发布时间】:2014-12-29 23:01:15
【问题描述】:
我发现这段代码可以将垂直滚动变为水平滚动。我怎样才能达到相反的效果?先感谢您。
HTML:
<div id='first'>
<div id='second'>
<!-- content -->
</div>
CSS:
#first {
overflow:hidden;
height:9000px;
}
#second {
width:9000px;
position:fixed;
}
JS:
window.onscroll=function() {
var scroll = window.scrollY;
$('#second').css('left', '-' + scroll + 'px');
}
【问题讨论】:
标签: jquery html css scroll horizontal-scrolling