I am trying to make some text scroll vertically using jQuery, I have been following the code example on http://www.switchonthecode.com/tutorials/using-jquery-slider-to-scro开发者_运维知识库ll-a-div
Please can someone guide me on how to achieve
- Position the slider vertically
- Make the text scroll vertically when the slider is moved up or down
EDIT : (comment on @lonesomeday's answer) I've already tried setting orientation:vertical
and tried changing
scrollWidth
toscrollHeight
width
toheight
scrollLeft
toscrollTop
in the functions handleSliderChange
and handleSliderSlide
but that doesn't work
Many thanks
Using the jQuery UI slider, you can do this easily with the orientation switch:
$('#slider').slider({orientation: 'vertical'});
In the example you're using, you should invoke it as follows:
$(document).ready(function(){
$("#content-slider").slider({
animate: true,
change: handleSliderChange,
slide: handleSliderSlide,
orientation: vertical
});
});
Note that you'll probably have to make some styling changes to make it look as pretty as the original example.
精彩评论