I have a container div
with a ul
inside of it setup like this jsFiddle: http://jsfiddle.net/BQPVL/1/
Why isn't the scroll working?
HTML:
<div id="outside">
<ul id="inside">
<li>hi</li>
<li>how are you?</li>
<li>i am good.</li>
</ul>
</div>
<button id="left">←</button>
<button id="right">→</button>
CSS:
#outside {
width: 200px;
height: 50px;
overflow: scroll;
}
#inside {
width: 1000px;
}
#inside li {
background: red;
width: 99px;
height: 40px;
border-right: 1px solid black;
float: left;
padding: 5px;
}
jQuery:
var position = $("#inside").scrollLeft();
$(document).ready(function() {
$("#right").bind("click", function() {
$("#inside").animate({
scrollLeft: position + 100
}, 1000);
});
});