sách gpt4 ai đã đi

jqueryscrollLeft tự động?

In lại 作者:行者123 更新时间:2023-12-01 08:18:30 29 4
mua khóa gpt4 Nike

我想做的是,如果鼠标位于“下一个”按钮上,它会以慢速向右滚动,如果鼠标没有位于“下一个”按钮上,它会停止滚动?

这是我的尝试http://jsfiddle.net/mdanz/nCCRy/14/

$(hàm() {

$('#next-button').hover(function() {
$('#display-container').animate({
'scrollLeft': '+=120px'
}, '500');
});

});

1 Câu trả lời

查看 jQuery 的 .stop()方法:

var $container = $('#display-container'),
scroll = $container.width();
$('#next-button').hover(function() {
$container.animate({
'scrollLeft': scroll
}, 500);
}, function(){
$container.stop();
});

这是 fiddle :http://jsfiddle.net/nCCRy/17/

关于jqueryscrollLeft 自动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8872096/

29 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com