jQuery scrollToを使用して、オーバーフローしたdiv内のコンテンツをスクロールしています。リンクをクリックすると、divはその内容を垂直方向にスクロールします。ただし、リンクをクリックするのではなく、リンクにカーソルを合わせると、この効果が発生するようにしたいと思います。
これがjQueryのscrollToのオプションだとは思いません。ただし、イベント用のjQueryAPIメソッドがありますhover
。
これは単純な質問のように思えるかもしれませんが、クリックする代わりにカーソルを合わせると、「scrollTo」の垂直スクロール機能を維持する方法はありますか?
垂直スクロール:
jQuery(function ($) {
$.localScroll.defaults.axis = 'y';
$.localScroll({
target: '#content',
// could be a selector or a jQuery object too.
queue: true,
duration: 500,
hash: false,
onBefore: function (e, anchor, $target) {
// The 'this' is the settings object, can be modified
},
onAfter: function (anchor, settings) {
// The 'this' contains the scrolled element (#content)
}
});
});
ホバリング:
$("#page-wrap li.button").hover(function(){ /* vertically slide here? */ });V