0

In my application, there are some cards which can be scrollable left to right by using left/right paddles. These paddles are visible when we mouseover on cards.

Now, This is working fine on desktop in all browser(safary,firefox,chrome). Even if i change the responsive design it is working fine.

Problem is visible when we use ipad(ios simulator). Those paddles are visible while hovering over those cards. Paddles are coming if we click on those cards first.

Div layout

    <div
              v-show="grid"
              class="second-row"
              @mouseover="showPaddle"
              @scroll.passive="setScrolledLeft"
            > .... normal code 
</div>

showPaddle method

showPaddle() {
  const secondRowEl = this.$el.querySelector('.second-row');
  const gridWidth = this.$el.querySelector('.grid').clientWidth;
  const scrollMax = gridWidth - secondRowEl.clientWidth;
  if (gridWidth > secondRowEl.clientWidth) {
    if (secondRowEl.scrollLeft > 0 && secondRowEl.scrollLeft < scrollMax) {
      this.showLeftPaddle = true;
      this.showRightPaddle = true;
    } else if (secondRowEl.scrollLeft >= scrollMax) {
      this.showLeftPaddle = true;
      this.showRightPaddle = false;
    } else if (secondRowEl.scrollLeft <= 0) {
      this.showLeftPaddle = false;
      this.showRightPaddle = true;
    }
  } else {
    this.showLeftPaddle = false;
    this.showRightPaddle = false;
  }
}

This code and everything is working fine on all browser in desktop/laptop but not working in ipad(ios simulator).

Please tell me any workaround on this.

user7411584
  • 523
  • 2
  • 12
  • 1
    There is no "mouseover" event on touch devices: https://stackoverflow.com/a/4551043/5781499 – Marc Nov 18 '20 at 12:06
  • Is there any work around on this by using touch events? – user7411584 Nov 18 '20 at 12:51
  • spontaneously I would only think of display the right/left paddles permanent on mobile devices (or touch in general). Quick search how to detect a touch device: https://stackoverflow.com/a/4819886/5781499 – Marc Nov 18 '20 at 13:15
  • i understood this. Can you help me to rewrite so i can fixed paddles for touch devices and hovering on other devices – user7411584 Nov 19 '20 at 06:11
  • If you post a minimal working example, sure. – Marc Nov 19 '20 at 08:35

0 Answers0