I am attempting to implement a vertical scroller using jQuery, but I'm encountering difficulties with my code.
function scrolldown() {
var newtop = $('.scroll-content').css('top') + '250';
$('.scroll-content').css({top: newtop});
}
The CSS:
.scroll-content {position:absolute; top:0px}
The issue lies in the JavaScript code. While I can easily modify values in Firebug, the code doesn't seem to be working as expected. My intention is to add 250px to the current value, but it's not functioning correctly. When I use .html(newtop)
, the output for the "top" value is displayed as 0px250... Any suggestions on what I might be doing wrong?