以前項目做得選擇門店是鼠標移動經過門店,下面直接該門店信息。用戶選擇門店時候鼠標移動,用onmouseover體驗效果不好
遂想到用setInterval()方法。HTML DOM setInterval() 方法
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title></title> 5 <script type="text/javascript"> 6 function show() { 7 alert("延時加載事件"); 8 } 9 </script> 10 </head> 11 <body> 12 <a href="#" onmouseover="ys=window.setInterval('show()',2000)" onmouseout="window.clearInterval(ys)">鼠標經過或者停留觸發事件</a> 13 </body> 14 </html>
