这引用了http://jsfiddle.net/PDtRA/显示菜单div中的滚动div。有没有办法让目标超出#menu? 我有一个粘性标题,顶部有固定位置。我试图让目标div在粘性标题下滚动。我使用相同的Ariel Flesler卷轴js作为小提琴...但我的卷轴不会。
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="javascript/jquery.localscroll-min.js"></script>
<script type="text/javascript" src="javascript/jquery.scrollTo-min.js"></script>
<script type="text/javascript">
// When the document is loaded...
$(document).ready(function()
{
// Scroll the content inside the #scroll-container div
//alert($('#menu').length);
$('#menu').localScroll({
target:'#hom'
});
});
</script>
</head>
<body>
<div id="header">
<div id="menu">
<ul>
<li><a href="#inter">INTERACTIVE</a></li>
<li><a href="#time"> TIME</a></li>
<li><a href="#vis">VIS-COMM</a></li>
<li><a href="#dig">DIGI-PAINT</a></li>
</ul>
</div>
</div>
<div id="hom">
<div id="inter"> some stuff</div>
<div id="time"> some stuff</div>
<div id="vis"> some stuff</div>
<div id="dig"> some stuff</div>
</div>
答案 0 :(得分:0)
使用id = hom
设置div上的溢出滚动样式<div id="hom" style="overflow:scroll;">
<div id="inter"> some stuff</div>
<div id="time"> some stuff</div>
<div id="vis"> some stuff</div>
<div id="dig"> some stuff</div>
</div>
希望它有所帮助。