summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/wwwroot/Content/js/index.js
blob: 04db5c2fa6ef933c553ec9535a26196f8ba603a5 (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
$(document).ready(function () {
    /* enable pufferchick */
    var pufferchick = $("#pufferchick");
    $(".cta-dropdown").hover(
        function () {
            pufferchick.attr("src", "Content/images/pufferchick-cool.svg");
        },
        function () {
            pufferchick.attr("src", "Content/images/pufferchick.svg");
        }
    );

    /* enable download dropdowns */
    $(".cta-dropdown a.download").each(function(i, button) {
        button = $(button);
        var wrapper = button.parent(".cta-dropdown");
        var button = wrapper.find(".download");
        var dropdownContent = wrapper.find(".dropdown-content");

        $(window).on("click", function(e) {
            var target = $(e.target);

            // toggle dropdown on button click
            if (target.is(button) || $.contains(button.get(0), target.get(0))) {
                e.preventDefault();
                dropdownContent.toggle();
            }

            // else hide dropdown
            else
                dropdownContent.hide();
        });
    });
});