Get started with jquery.mosaicflow CDN

MIT licensed

JQuery.mosaicflow is a plugin that creates a dynamic, grid-based layout for image galleries.

Tags:
  • mosaic
  • jquery
  • mosaicflow
  • pinterest
  • responsive

Stable version

Copied!

How to start using jquery.mosaicflow CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with jquery.mosaicflow CDN - cdnhub.io</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/masonry/4.3.0/masonry.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.cdnhub.io/jquery.mosaicflow/0.2.5/jquery.mosaicflow.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/masonry/4.3.0/masonry.pkgd.min.js"></script>
    <style>
        .grid {
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 100%;
        }
        .grid li {
            width: 25%;
            height: 0;
            padding-bottom: 25%;
            position: relative;
            overflow: hidden;
        }
        .grid img {
            width: 100%;
            height: auto;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            margin: auto;
        }
    </style>
</head>
<body>
    <ul class="grid">
        <li>
            <img src="image1.jpg" alt="Image 1">
        </li>
        <li>
            <img src="image2.jpg" alt="Image 2">
        </li>
        <li>
            <img src="image3.jpg" alt="Image 3">
        </li>
        <li>
            <img src="image4.jpg" alt="Image 4">
        </li>
        <li>
            <img src="image5.jpg" alt="Image 5">
        </li>
        <li>
            <img src="image6.jpg" alt="Image 6">
        </li>
    </ul>

    <script>
        $(document).ready(function() {
            $('.grid').mosaicflow({
                columnWidth: 0.25,
                gutter: 0
            });
        });
    </script>
</body>
</html>
Copied!
Copied!

All versions