我有一个可滚动的区域和按钮<
>
来让它滚动。
我需要将这些按钮span
放在主 div ( spinAreaDiv
) 内,而不会滚动它们。
问:我错过了什么?(在这里小提琴)我尝试了span
with float
,然后它们在里面spinAreaDiv
但被滚动了......
HTML
<div id="spinAreaDiv">
<span id="leftclick" class="left"> < </span>
<span id="rightclick" class="right"> > </span>
<div class="spin-bullets">
zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...
zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...
zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...
zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...
zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...zzzZZzzz...
</div>
JS:
spinAreaDiv = document.getElementById('spinAreaDiv');
scrollEff = new Fx.Scroll(spinAreaDiv, {
wait: false,
duration: 1000,
offset: {
'x': 0,
'y': 0
},
transition: Fx.Transitions.Quad.easeInOut
});
thumbLeft = document.getElementById('leftclick');
thumbRight = document.getElementById('rightclick');
thumbLeft.addEvent("click", function () {
scrollEff.start((spinAreaDiv.getScroll().x) - 400, 0);
});
thumbRight.addEvent("click", function () {
scrollEff.start((spinAreaDiv.getScroll().x) + 400, 0);
});
CSS:
#spinAreaDiv {
width:500px;
margin-left:10%;
overflow:auto;
height:60px;
background-color:grey;
}
span {
margin-top:20px;
background-color:red;
z-index:100;
}
span.right {position:absolute;right:0px;}
span.left {position:absolute;left: 0;}
.spin-bullets {
width:10000px;
height:35px;
padding-top:10px;
top:0px;
background-color:#066;
}
(使用 Mootools Fx.Scroll)