hello,
how do i make a scrolling div always start at the top ?
i have used the code from this post :
i works great but when i refresh the page it does not go back to the top of the div (the latest post)
this is the code :
<!-- HOME HOME TWITTER SCROLL UP / DOWN -->
$(function() {
var ele = $('#scroll');
var speed = 50, scroll = 5, scrolling;
$('#sw-up').mouseenter(function() {
// Scroll the element up
scrolling = window.setInterval(function() {
ele.scrollTop( ele.scrollTop() - scroll );
}, speed);
});
$('#sw-down').mouseenter(function() {
// Scroll the element down
scrolling = window.setInterval(function() {
ele.scrollTop( ele.scrollTop() + scroll );
}, speed);
});
$('#sw-up, #sw-down').bind({
click: function(e) {
// Prevent the default click action
e.preventDefault();
},
mouseleave: function() {
if (scrolling) {
window.clearInterval(scrolling);
scrolling = false;
}
}
});
});
thanks
ricky