Why is there this little lag between (click) and actual fct call & how can i remove it? (video)


#1

Hi,

I am training by making a ruzzle-like. I don’t understand how to remove this little lag.
It is (click) event. My function Touched() does other stuff but it is not coming from that. I tested with an empty test() function and console.log().

Beside, how to make the letters selected on swipe? Because (swipe) is not working.

A little video:
https://sendvid.com/m046dmy6#

My simple code:

<div class="letter" (click)="Touched()" [ngClass]="{'touched': touched }">
{{value}}
</div>

#2

Try adding the ‘tappable’ directive to your div

<div class="letter" tappable (click)="Touched()" [ngClass]="{'touched': touched }">
     {{value}}
</div>

#3

Thanks. I ll try it tonight.

For other who might read this thread, you can find ressource here:


#4

Still having this lag… Any idea ?


#5

Sometime to solve a problem you just need to read the doc. Of ionic, then angular, then mozilla !


#6

Try (tap) in stead of (click).


#7

same issue… I tried other dom event as mouseleave or mouseenter :frowning: same issue. Working perfectly on browser.


#8

Right in the link you posted, it’s said that you should not click it from a div, that that’s exactly what makes the delay to happen. try:

<div class="letter" (click)="Touched()" [ngClass]="{'touched': touched }">
 <a  (click)="Touched()">
  {{value}}
 </a>
</div>

#9

Yes, I tried with tappable, without, with click, mouseenter…doesn’t change anything. Still having a lag.