jQuery.ScrollTo / jQuery.SerialScroll Horizontal Scrolling

I am looking to implement horizontal scrolling using [jQuery.SerialScroll][1] (based on [jQuery.ScrollTo][2]). I currently have a continuous horizontal scrolling working with liScroll as I discuss in [this post][3]. However, now I need discrete scrolling and I have SerialScroll working perfectly for vertical scrolling. For some reason, if the 'axis' property is specified as 'x' nothing happens. I can't even get the [SerialScroll example for right to left scrolling][4] to work. I have HTML like this:
Item 1
Item 2
Item 3
I have jQuery like this, that works when axis is 'y' jQuery(function($) { var $pane = $('#pane'); $pane.serialScroll({ items: 'div', next: $pane, // the container itself will get bound duration: 2100, force: true, axis: 'x', step: 1, //scroll 1 news each time event: 'showNext' //just a random event name }); setInterval(function() {//scroll each 12 seconds $pane.trigger('showNext'); }, 12000); }); Any ideas? //Edit (answer accepted) For those that come along, the accepted answer gets rid of the need for "serialScroll" (just need scrollTo). Heights weren't required. Be sure to change $('scroller') to something like $('mywrap') or $(target.parent().parent()). You can also set up automatic scrolling like this: var index = 2; setInterval(function() {//scroll each 5 seconds index = index > $('#news ul li').length ? 1 : index; sliderScroll($('#news ul li:nth-child(' + index + ')')); index ++; }, 5000); replacing #news ul li to your appropriate selector. [1]: http://flesler.blogspot.com/2008/02/jqueryserialscroll.html [2]: http://demos.flesler.com/jquery/scrollTo/ [3]: https://stackoverflow.com/questions/41027/whats-a-good-bit-of-js-or-jquery-for-horizontally-scrolling-news-ticker [4]: http://flesler-plugins.googlecode.com/files/SerialScroll_right-to-left.js

以上就是jQuery.ScrollTo / jQuery.SerialScroll Horizontal Scrolling的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » jQuery 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准