2010-10-12 94 views
0

我试图让垂直使用jQuery一些文字滚动,我​​一直跟着上http://www.switchonthecode.com/tutorials/using-jquery-slider-to-scroll-a-divjQuery的幻灯片文本垂直

的代码示例,请能有人指导我如何实现

  1. 位置滑块垂直
  2. 使文本滚动垂直当滑块向上或向下移动

编辑:(上@ lonesomeday的答案评论)我已经尝试设置orientation:vertical和功能handleSliderChange试图改变

  1. scrollWidthscrollHeight
  2. widthheight
  3. scrollLeftscrollTop

handleSliderSlide但不起作用

非常感谢

回答

0

使用jQuery UI slider,您可以用方向开关做到这一点很容易:

$('#slider').slider({orientation: 'vertical'}); 

在你使用的例子,你应该按照以下方式调用它:

$(document).ready(function(){ 
    $("#content-slider").slider({ 
    animate: true, 
    change: handleSliderChange, 
    slide: handleSliderSlide, 
    orientation: vertical 
    }); 
}); 

请注意,您可能必须进行一些样式更改才能使其看起来像原始示例一样漂亮。

+0

谢谢你的时间。我已经尝试了你的建议,请参阅我编辑的问题。 – 2010-10-12 11:57:27

+0

互联网上有垂直滑块教程(例如[this one](http://www.simonbattersby.com/demos/vertical_scrollbar_demo.htm))。我建议你尝试使用其中之一。 – lonesomeday 2010-10-12 12:30:34

+0

太棒了:)非常感谢 – 2010-10-12 12:55:16