Welcome to mirror list, hosted at ThFree Co, Russian Federation.

main.js « js « static - github.com/chipsenkbeil/grid-side.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 147247a3b06ef61e2d48f065cfa4ebbbdfd219f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$(document).ready(function(){
    // Employ Masonry layout configuration
    var $container = $(".masonry-flex-container")
    $container.imagesLoaded().always(function(instance) {
        $container.masonry({
            itemSelector: ".flex-item",
            columnWidth: ".flex-item",
            percentPosition: true,
            transitionDuration: 0 /* Disable animation of transitions */
        });

        $(window).resize(function() {
            $container.masonry();
        });
    });

    $container.each(function() {
        this.addEventListener("load", function() {
            $container.masonry();
        }, true);
    });

    // Provide infinite scroll if enabled
    var $infiniteContainer = $(".masonry-flex-container.infinite-scroll").infinitescroll({
        navSelector: "ul.pagination",
        nextSelector: "ul.pagination a:last",
        itemSelector: ".masonry-flex-container .flex-item"
    }, function(elements) {
        var $elements = $(elements);
        $elements.imagesLoaded(function() {
            $infiniteContainer.masonry("appended", $elements);
        });
    });

    // Attach our lightbox handlers
    $("[data-lightbox-id]").each(function() {
        var element = $(this);
        var lightboxId = element.data("lightbox-id");
        var lightbox = $("#" + lightboxId);

        var lightboxProperties = {
            "padding": "70px",
            "width": "100%",
            "height": "100%",
            "background-color": "rgba(0, 0, 0, 0.95)",
            "color": "white",
            "position": "fixed",
            "top": "0px",
            "left": "0px",
            "z-index": "999"
        };
        lightbox.css(lightboxProperties);
        lightbox.hide();

        var lightboxCloseButtonProperties = {
            "position": "absolute",
            "top": "0px",
            "left": "0px",
            "z-index": "999",
            "cursor": "pointer"
        };

        var lightboxCloseButton = $("<i/>", {
            "class": "fa fa-close fa-5x",
            "click": function(e) {
                e.preventDefault();
                lightbox.hide("fast");
            }
        });
        lightboxCloseButton.css(lightboxCloseButtonProperties);
        lightboxCloseButton.appendTo(lightbox);

        element.click(function(e) {
            e.preventDefault();
            lightbox.show("fast");
        });
    });

    // Provide syntax highlighting if highlight.js included
    if (typeof hljs !== "undefined") {
        hljs.initHighlightingOnLoad();
    }
});