bootstrap-center-div-vertically-and-horizontally
Version:
Responsive Center div vertically and horizontally built with Bootstrap 5. To center div both vertically and horizontally use flexbox utilities. See the example.
25 lines (22 loc) • 489 B
JavaScript
class TouchUtil {
_getCoordinates(e) {
const [touch] = e.touches;
return {
x: touch.clientX,
y: touch.clientY,
};
}
_getDirection(displacement) {
return {
x: {
direction: displacement.x < 0 ? 'left' : 'right',
value: Math.abs(displacement.x),
},
y: {
direction: displacement.y < 0 ? 'up' : 'down',
value: Math.abs(displacement.y),
},
};
}
}
export default TouchUtil;