JSFiddle - React, Tailwind, and code Playground

by prodac

HTML

<div id="container">
    <div id="photo-gallery">
    
        <ul id="gallery-ul">
        <!-- The Photo Gallery will be loaded into here -->
        
        </ul><!-- #gallery-ul -->
        
    </div><!-- #photo-gallery -->

</div><!-- #container -->
<script type="text/javascript">
    Shadowbox.init();
</script>

CSS

/* @override http://cattani.businesscatalyst.com/projects/css/style.css */

/* ---------->>> RESET  <<<-----------*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-weight: inherit;
    font-style: inherit;
    font-size: 100%;
    font-family: inherit;
    vertical-align: baseline;
}

:focus {
    outline: 0;
}

body {
    line-height: 1;
    color: black;
    background: white;
    width: 445px;
    height: 353px;
}

table {
    border-collapse: separate;
    border-spacing: 0;
}

caption, th, td {
    text-align: left;
    font-weight: normal;
}

blockquote:before, blockquote:after, q:before, q:after {
    content: "";
}

blockquote, q {
    quotes: "" "";
}

#block {
    width: 600px;
    height: 500px;
    margin: 50px auto;
}

.clear {
    clear: both;
}

/* ---------->>> BODY  <<<-----------*/

#container {
    overflow: hidden;
    width: 445px;
    height: 353px;
    background-color: #343434;
    font-size: 11px;
    padding: 15px 30px 30px 15px;
    color: #828282;
}

/*=============== PHOTO GALLERY ================= */

#photo-gallery {
    width: 100%;
    position: relative;
    overflow: hidden;
    margin: 10px auto;
}

#gallery-ul {
    list-style: none;
    position: relative;
    width: 515px;
    margin: 0 auto;
}

#gallery-ul li {
    display: block;
    height: 81px;
    width: 81px;
    float: left;
    margin: 10px;
    position: relative;
    border: 1px solid #C0C0C0;
    background: #F2F2F2;
    overflow: hidden;
}

#gallery-ul li a {
    display: block;
    height: 75px;
    width: 75px;
    position: absolute;
    top: 3px;
    left: 3px;
    z-index: 5;
}

img.thumb {
    width: 100%;
   ...

JavaScript

$(function () {

               $.ajax({
                type: "GET",
                url: "http://cattani.businesscatalyst.com//projects/img/Bathurst/PhotoGallery.xml", // location of your gallery's xml file
                dataType: "xml",
                success: function(xml) {


                    $(xml).find('img').each(function() {

                       var location = 'http://cattani.businesscatalyst.com/projects/img/Bathurst/'; // relative path to the directory that holds your images
                       var url = $(this).attr('src');
                        var alt = $(this).attr('alt');

                        $('<li></li>').html('<a href="'+location+''+url+'" rel="shadowbox[gallery]"><img class="thumb" src="'+location+''+url+'" alt="'+alt+'" title="'+alt+'" /></a>').appendTo('#gallery-ul');


                    });
                    $('<script type="text/javascript"></script>').html('Shadowbox.clearCache(); Shadowbox.setup();').appendTo('#photo-gallery');
                }


            });
});