标题闪烁

<script type="text/javascript">
        var titleText = "<!--{TWINKLE_TITLE}-->";
        if (titleText.substring(4) === "{TWINKLE_TITLE}-->") {
            titleText = document.title;
        }

        function twinkleTitle(rawTitle, execCount, nextRunMillis) {
            if ((execCount % 2) === 0) {
                document.title = "            ";
            } else {
                document.title = rawTitle;
            }
            setTimeout(function(){
                twinkleTitle(rawTitle, ++execCount, nextRunMillis);
            }, nextRunMillis);
        }
        twinkleTitle(titleText, 0, 500);
    </script>

 

posted @ 2016-08-04 11:01  djdliu  阅读(169)  评论(0编辑  收藏  举报