<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8"/>
        <title>使用最短的代码生成元素的闪烁效果</title>
        <style type="text/css">
            .blink{
                width: 150px;
                height: 150px;
                -webkit-border-radius: 50%;
                border-radius: 50%;
                background: orange;
            }
        </style>
        <script type="text/javascript" src="../js/jquery-1.11.0.js"></script>
        <script type="text/javascript">
            /*$(function(){
                var $blink = $('.blink'), show = true;
                window.setInterval(function() {
                    if (show) {
                        $blink.hide();
                        show = false;
                    } else {
                        $blink.show();
                        show = true;
                    }
                }, 500);
            });*/
        </script>
    </head>
    <body>
        <div class="blink"></div>
        <script type="text/javascript">
            (function() {
                $('.blink').fadeToggle(500 / 2, arguments.callee);
            })();
        </script>
    </body>
</html>

 

posted on 2015-03-02 22:30  爱生活的夜  阅读(110)  评论(0编辑  收藏  举报