Isotope masonry produces different output compared to demo

88 Views Asked by At

I am trying to learn Isotope . There's a particular demo that I'm trying and I've copied the code from the given fiddle here

However, the outputs are different.

  1. My output: enter image description here

  2. Output on the demo site: enter image description here

The browser is maximized and I'm viewing both on the same screen. Here's the code on my page:

  <html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
    * { box-sizing: border-box; }

    body { font-family: sans-serif; }

    /* ---- grid ---- */

    .grid {
        background: #DDD;
        max-width: 1200px;
    }

    /* clear fix */
    .grid:after {
        content: '';
        display: block;
        clear: both;
    }

    /* ---- .grid-item ---- */

    .grid-item {
        float: left;
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
        background: #0D8;
        border: 2px solid #333;
        border-color: hsla(0, 0%, 0%, 0.7);
    }

    .grid-item--width2 { width: 220px; }
    .grid-item--height2 { height: 220px; }

</style>

</head>
<body>
<h1>Isotope - masonry gutter, with margin bottom</h1>

<div class="grid">
    <div class="grid-item grid-item--width2"></div>
    <div class="grid-item grid-item--height2"></div>
    <div class="grid-item"></div>
    <div class="grid-item"></div>
    <div class="grid-item grid-item--width2 grid-item--height2"></div>
    <div class="grid-item grid-item--width2"></div>
    <div class="grid-item grid-item--width2"></div>
    <div class="grid-item grid-item--height2"></div>
    <div class="grid-item"></div>
    <div class="grid-item grid-item--width2"></div>
    <div class="grid-item grid-item--height2"></div>
    <div class="grid-item"></div>
    <div class="grid-item"></div>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script type="text/javascript" src="https://npmcdn.com/[email protected]/dist/isotope.pkgd.js"></script>
<script type="text/javascript">


    $('.grid').isotope({
        itemSelector: '.grid-item',
        masonry: {
            columnWidth: 100,
            gutter: 20
        }
    });
</script>
</body>
</html>

1

There are 1 best solutions below

0
On BEST ANSWER

Jquery had not been inserted. Thanks to @MostafaBaezid for the hint.