使用JavaScript代码单击链接后,我想停止闪烁“视图”链接:
css:
.blinking span {
-webkit-animation: 0.5s linear infinite condemned_blink_effect;
animation: 1.5s linear infinite condemned_blink_effect;
}
@-webkit-keyframes condemned_blink_effect {
0% {
visibility: hidden;
}
50% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
@keyframes condemned_blink_effect {
0% {
visibility: hidden;
}
50% {
visibility: hidden;
}
100% {
visibility: visible;
}
}
php和JS:
<?php
echo "<tr >";
echo "<td width='150'> <a href='disdata.php?id=" . $dispReturn->dispID . "' class='blinking'><span> View </span> </a> </td> ";
echo "</tr>";
?>
<script>
function stopBlinking(e) {
e.currentTarget.classList.remove('blinking');
}
const blinking = document.querySelectorAll('.blinking');
for (link of blinking) {
link.addEventListener("click", stopBlinking);
}
</script>
单击后,JS代码无法停止链接“视图”的闪烁,因此我希望通过修改我的JS代码来停止单击链接后的闪烁效果。