Skip to content
Discussion options

You must be logged in to vote

Hey @web-dev-0, you don't have to touch the dynamic height logic at all. You can just listen for the wheel event and react to horizontal scroll.

Here is an example that you can implement

function handleWheel(e) {
  const dx = e.originalEvent.deltaX || 0;
  const dy = e.originalEvent.deltaY || 0;

  if (Math.abs(dx) > Math.abs(dy)) {
    e.preventDefault();
    dx > 30
      ? $(this).slick('slickNext')
      : dx < -30 && $(this).slick('slickPrev');
  }
}

$('.ai-slider-section').on('init', function () {
  $(this).on('wheel', handleWheel);
});

in practice, this should enable the trackpad swipe as well as the horizontal mouse wheel navigation without breaking anything else. Let me know if…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@web-dev-0
Comment options

@IvanPavlovic-web
Comment options

Answer selected by web-dev-0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Ask and answer questions about GitHub features and usage Programming Help Discussions around programming languages, open source and software development
2 participants