我使用 NG Gallery 在 wordpress 上制作了水平画廊。
我想使用鼠标滚轮并通过单击画廊区域并移动来滚动画廊。 现在我只能通过单击图库底部的滚动条并手动移动来移动图像。 我怎样才能实现它?
这是我的自定义代码:
.ngg-galleryoverview {
display: table-row;
float: none;
max-width: 100%;
overflow-x: scroll;
overflow-scrolling: touch;
clear: both;
}
.ngg-gallery-thumbnail-box {
display: table-cell;
float: none;
}
.ngg-gallery-thumbnail {
width: 415px;
}
最佳答案
添加这个它正在处理鼠标滚轮事件 library
去处理鼠标滚轮事件
$('#footer').on('mousewheel', function(event) {
//console.log(event.deltaX, event.deltaY, event.deltaFactor);
if(event.deltaY==1){
$(this).animate({scrollLeft: '+=10px'}, 100);
}else if(event.deltaY==-1){
$(this).animate({scrollLeft: '-=10px'}, 100);
}
});
关于javascript - 水平画廊 - 滚动和触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44521655/