mirror of
https://github.com/GuduleLapointe/opensim-helpers.git
synced 2026-08-14 00:47:54 +00:00
36 lines
830 B
JavaScript
36 lines
830 B
JavaScript
/**
|
|
* js/guide.js
|
|
*
|
|
* @package magicoli/opensim-helpers
|
|
* @subpackage magicoli/opensim-helpers/guide
|
|
*
|
|
* @author Gudule Lapointe <gudule@speculoos.world>
|
|
* @link https://github.com/magicoli/opensim-helpers
|
|
* @license AGPLv3
|
|
*/
|
|
|
|
// JavaScript code to force horizontal scrolling with mouse wheel
|
|
document.querySelector( '#guide .list' ).addEventListener(
|
|
'wheel',
|
|
function (event) {
|
|
// Check if Shift key is pressed to allow vertical scrolling
|
|
if (event.shiftKey) {
|
|
return;
|
|
}
|
|
|
|
// Prevent the default vertical scrolling behavior
|
|
event.preventDefault();
|
|
|
|
// Calculate the scroll amount
|
|
const scrollAmount = event.deltaY * 1.5;
|
|
|
|
// Set the horizontal scroll position
|
|
this.scrollBy(
|
|
{
|
|
left: scrollAmount,
|
|
behavior: 'smooth', // Add a smooth scrolling effect
|
|
}
|
|
);
|
|
}
|
|
);
|