<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>42度空间-弹性布局(flexbox) 之 flex-wrap测试</title>
    <style>
        .box {
            display: flex;
            border : 1px solid #ccc;
            margin:0.5rem;
        }
        .item {
            color:#fff;
            background: #000;
            padding: 0.5em 1em;
            margin: 0.5em;
            text-align: center;
        }
        label {
            padding: 2px 4px;
            font-size: 90%;
            color: #c7254e;
            background-color: #f9f2f4;
            border-radius: 4px;
        }
    </style>
</head>
<body>
<div id="wrapper">
    <label for="box1" id="my-label">flex-wrap : nowrap; </label>
    <div class="box" id="box1">
        <div class="item">1 An ounce of prevention is worth a pound of cure.</div>
        <div class="item">2 过早的优化是罪恶之源。</div>
        <div class="item">3 UNIX很简单。但需要有一定天赋的人才能理解这种简单。</div>
    </div>
</div>
<script type="text/javascript" src="http://res.42du.cn/vendor/jquery/jquery.min.js"></script>
<script>
    $(document).ready(function () {
        var vals = ["nowrap","wrap","wrap-reverse"];
        var i = 1;
        var stop = false;
        var id = setInterval(function () {
            if(!stop) {
                $("#my-label").html("flex-wrap: "+vals[i]+";");
                $("#box1").css("flex-wrap",vals[i]);
                i++;
                i = i > 2 ? 0 : i;
            }
        },2000);
        $("#wrapper").click(function () {
            stop = !stop;
        });
    });
</script>
</body>
</html>