I am developing a wordpress theme that has the function of changing the background image by hovering over a menu item (each menu item is attached to a different image). On a mobile device, I would like to change the background image by simply scrolling so that viewers do not need to click each menu to change the background image.
This is the method that I used to change the background by hanging.
http://codepen.io/nummelin/pen/kzaso
$( ".sidebarContainer a" ).hover(function() {
$('.sidebar1').removeClass().addClass('sidebar1');
var URI = $(this).attr('href').split('/');
console.log(URI[2]);
$('.sidebar1').addClass(URI[2]);
});
Reaching the scroll, I think I need a function that hangs on a menu item by its position, as shown below.

Does anyone have any ideas how to achieve this? I studied a plugin or code sample like this, but did not find ... Any advice would be appreciated.