FIX: fix dragging in horizontal overflow component (#20018)
This commit is contained in:
parent
95999c80ce
commit
156e04515f
|
@ -78,19 +78,20 @@ export default class HorizontalOverflowNav extends Component {
|
||||||
const mouseDragScroll = function (e) {
|
const mouseDragScroll = function (e) {
|
||||||
let mouseChange = e.clientX - position.x;
|
let mouseChange = e.clientX - position.x;
|
||||||
navPills.scrollLeft = position.left - mouseChange;
|
navPills.scrollLeft = position.left - mouseChange;
|
||||||
|
|
||||||
navPills.querySelectorAll("a").forEach((a) => {
|
|
||||||
a.style.cursor = "grabbing";
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
navPills.querySelectorAll("a").forEach((a) => {
|
||||||
|
a.style.cursor = "grabbing";
|
||||||
|
});
|
||||||
|
|
||||||
const removeDragScroll = function () {
|
const removeDragScroll = function () {
|
||||||
|
document.removeEventListener("mousemove", mouseDragScroll);
|
||||||
navPills.querySelectorAll("a").forEach((a) => {
|
navPills.querySelectorAll("a").forEach((a) => {
|
||||||
a.style.cursor = "pointer";
|
a.style.cursor = "pointer";
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
document.addEventListener("mousemove", mouseDragScroll, { once: true });
|
document.addEventListener("mousemove", mouseDragScroll);
|
||||||
document.addEventListener("mouseup", removeDragScroll, { once: true });
|
document.addEventListener("mouseup", removeDragScroll, { once: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue