I have this timeline.
http://jsfiddle.net/kthornbloom/zJ6kp/
I want to be able to implement some javascript so that you can click and drag to scroll across the timeline class
.timeline {
white-space:nowrap;
overflow-x: scroll;
padding:30px 0 10px 0;
position:relative;
}
This is the Javascript that I've tried but it does not seem to work.
$('#timeline-wrapper').mousedown(function(e) {
down = true;
scrollLeft = this.scrollLeft;
x = e.clientX;
}).mouseup(function() {
down = false;
}).mousemove(function(e) {
if (down) {
this.scrollLeft = scrollLeft + x - e.clientX;
}
}).mouseleave(function() {
down = false;
});
What would be the best way to implement this?
Thanks.