Skip to content
Discussion options

You must be logged in to vote

@AnsBdran in your case, navigation buttons can't be used directly on the carousel, as they'll block clicks by being a layer placed on top of the carousel viewport. If Embla registers a drag gesture, it will block click events from firing. But if the pointer gesture doesn't include dragging, Embla will let the click event pass. So I think what you need to do is to attach a click listener to the carousel viewport, and determine where the click happened. Something along these lines:

<script>
  function handleClick(event) {
    const x = event.clientX;
    const y = event.clientY;
    
    // TODO: Determine if the click was on the left or right half of the carousel viewport
    // if click i…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@AnsBdran
Comment options

Answer selected by davidjerleke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
resolved This issue is resolved question Question about how to achieve something
2 participants