Can any one edit this code and add code for scrolling horizontally via arrow keys also

<script type="text/javascript"> 
	function replaceVerticalScrollByHorizontal( event ) {
  if ( event.deltaY !== 0 ) {
   window.scroll(window.scrollX + event.deltaY * 2, window.scrollY );
   event.preventDefault();
  }
 }
	const mediaQuery = window.matchMedia( '(min-width: 770px)' );

 if ( mediaQuery.matches ) {
  window.addEventListener( 'wheel', replaceVerticalScrollByHorizontal );
 }
	</script>

Hello there,

We recommend familiarising yourself with how to ask a question on this forum. Specifically, you are more likely to get useful help, if you provide a helpful title and description:

thanks i will keep it in mind

here is the link to code thanks

<script type="text/javascript"> 
	function replaceVerticalScrollByHorizontal( event ) {
  if ( event.deltaY !== 0 ) {
   window.scroll(window.scrollX + event.deltaY * 2, window.scrollY );
   event.preventDefault();
  }
 }
	const mediaQuery = window.matchMedia( '(min-width: 770px)' );

 if ( mediaQuery.matches ) {
  window.addEventListener( 'wheel', replaceVerticalScrollByHorizontal );
 }
	</script>

Hello there,

We recommend familiarising yourself with how to ask a question on this forum. Specifically, you are more likely to get useful help, if you provide a helpful title and description:


I still don’t really see any context information. Talk to us. Tell us what is going on, what you want, what you’ve tried to get there, and what troubles you’ve had getting what you want.

Note that we will not write code for you. We are a code education platform, not a “do it for you” platform.

Hi! i have not learned coading i wrote it entirely by self learning, my main objective was to make a horizontal web page and scroll through it via arrow key’s on my keyboard.
The problem i am facing is that i cant find the right combination of functions and events to execute my vision. i tried window.scrollY and ‘keydown’ ‘keyup’ ‘key press’ functions.
P.S i made my website on Elementor Wordpress and am adding this code to custom code interface that is provided. Now as i am a beginer wen i see sample codes that are available online it is hard for me fine tune it to fit in. Highly appriciate the help and patience thanks.