5
In Android there is the method OnLongClickListener
in which it is possible to hold down the finger in a View
and an action is fired (if the developer sets an action) if that click remains a little more than 1 second.
I have this small table below with 4 colors. In Javascript what would be the best way to do this "long click" action when keeping the cursor pressed in some color? For example display a alert
with the color pressed.
<table>
<tbody>
<tr>
<td style="width: 24px; background-color: black;"> </td>
<td><span>black</span> = "#000000"</td>
<td style="width: 24px; background-color: green;"> </td>
<td><span>green</span> = "#008000"</td>
</tr>
<tr>
<td style="width: 24px; background-color: silver;"> </td>
<td><span>silver</span> = "#C0C0C0"</td>
<td style="width: 24px; background-color: lime;"> </td>
<td><span>lime</span> = "#00FF00"</td>
</tr>
</tbody>
</table>
On this same ration line, it is possible to log the name of the color of the pressed item ?
– viana
@acklay by color name you mean the value of the property
background-color
?– mercador
The value of each item when holding the cursor above.
– viana
@acklay updated the answer. If click and hold on
<td style="width: 24px; background-color: black;"> </td>
, you want to Logblack
, correct?– mercador