summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/wwwroot/Content/js/index.js
blob: d0734b022e37ec37309cf95f8409fbcf2fd2f6e5 (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.png");
        },
        function () {
            pufferchick.attr("src", "Content/images/pufferchick.png");
        }
    );

    /* 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();
        });
    });
});