天天看点

jQuery 怎么实现文字显示2s,消失0.5s,再显示2s,再消失0.5s,以此循环

<div style="display: none;" id='divTestDisplay'>我要显示的文字</div>  
   
   window.onload = function () {
           setTimeout(show, 500);
        }
       //显示
        function show() {
            document.getElementById('divTestDisplay').style.display = "block";
            setTimeout(hide, 500);
        }
     //隐藏
        function hide() {
            document.getElementById('divTestDisplay').style.display = "none";
            setTimeout(show, 2000);
        }      

转载于:https://www.cnblogs.com/zhibu/p/5191797.html

继续阅读