简体   繁体   English

jQuery垂直滑动文本

[英]Jquery slide text vertically

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-scroll-a-div 我正在尝试使用jQuery使某些文本垂直滚动,我一直在关注http://www.switchonthecode.com/tutorials/using-jquery-slider-to-scroll-a-div上的代码示例

Please can someone guide me on how to achieve 请有人可以指导我如何实现

  1. Position the slider vertically 垂直放置滑块
  2. 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 编辑:(评论@lonesomeday的答案)我已经尝试设置了orientation:vertical并尝试更改

  1. scrollWidth to scrollHeight scrollWidthscrollHeight
  2. width to height width height
  3. scrollLeft to scrollTop scrollLeftscrollTop

in the functions handleSliderChange and handleSliderSlide but that doesn't work handleSliderChangehandleSliderSlide函数中,但这不起作用

Many thanks 非常感谢

Using the jQuery UI slider , you can do this easily with the orientation switch: 使用jQuery UI滑块 ,您可以使用方向开关轻松完成此操作:

$('#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. 请注意,您可能必须进行一些样式更改,以使其看起来像原始示例一样漂亮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM