使用数据同位素来添加装订线值并设置div的高度

时间:2016-08-16 16:49:38

标签: javascript jquery html css jquery-isotope

Isotope CSS似乎没有CDN所以我会在这里粘贴代码:

<!doctype html>
<html class="export">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Isotope &#xB7; packery</title>

    <!-- Isotope does not require any CSS files -->
    <link rel="stylesheet" href="../css/isotope-docs.css" media="screen">

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

    <!-- custom -->
   <style type="text/css">
        .grid {
            border: none;
            background: none;
        }
        .square, .rec-tall {
            width: 50%;
        }
        .rec-wide {
            width: 100%;
        }
        .square-small {
            width: 25%;
        }
   </style>
</head>

<body class="page--packery" data-page="packery">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <div class="grid" data-isotope='{ "layoutMode": "packery", "gutter": "0" }'>
                    <div class="grid-splash-item square">1</div>
                    <div class="grid-splash-item rec-tall">2</div>
                    <div class="grid-splash-item square">3</div>
                    <div class="grid-splash-item rec-wide">4</div>
                    <div class="grid-splash-item square-small">5</div>
                    <div class="grid-splash-item">6</div>
                    <div class="grid-splash-item">7</div>
                    <div class="grid-splash-item">8</div>
                    <div class="grid-splash-item">9</div>
                    <div class="grid-splash-item">10</div>
                    <div class="grid-splash-item">11</div>
                    <div class="grid-splash-item">12</div>
                </div>
            </div>
        </div>
    </div>

    <!-- Isotope does NOT require jQuery. But it does make things easier -->
    <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
    <script src="../js/isotope-docs.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>

我正在尝试将装订线减少到0,因此div之间没有间距,因此所涉及的线是:

div class="grid" data-isotope='{ "layoutMode": "packery", "gutter": "0" }'>

但这似乎不起作用?

我还想改变div的高度,这样两个大小的方块实际上都是正方形,而rec-tall是1:2,rec-wide是2:1。

1 个答案:

答案 0 :(得分:0)

解决了它们:

<div class="grid" data-isotope='{ "layoutMode": "packery", "packery": { "gutter": -10 } }'>

引号太多了!