diff options
-rw-r--r-- | src/SMAPI.Web/Views/Index/Index.cshtml | 1 | ||||
-rw-r--r-- | src/SMAPI.Web/wwwroot/Content/js/index.js | 26 |
2 files changed, 11 insertions, 16 deletions
diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index c13c94a5..8ae23a45 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -4,6 +4,7 @@ @model StardewModdingAPI.Web.ViewModels.IndexModel @section Head { <link rel="stylesheet" href="~/Content/css/index.css" /> + <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" crossorigin="anonymous"></script> <script src="~/Content/js/index.js"></script> } diff --git a/src/SMAPI.Web/wwwroot/Content/js/index.js b/src/SMAPI.Web/wwwroot/Content/js/index.js index 54fdf6d9..c53592f8 100644 --- a/src/SMAPI.Web/wwwroot/Content/js/index.js +++ b/src/SMAPI.Web/wwwroot/Content/js/index.js @@ -1,16 +1,10 @@ -document.addEventListener('DOMContentLoaded', setupHover, false); - -function setupHover() { - var pufferchick = document.getElementById("pufferchick"); - var downloadLinks = document.getElementsByClassName("download"); - - for (var downloadLink of downloadLinks) { - downloadLink.addEventListener("mouseenter", function () { - pufferchick.src = "Content/images/pufferchick-cool.png"; - }); - - downloadLink.addEventListener("mouseleave", function () { - pufferchick.src = "favicon.ico"; - }); - } -} +$(document).ready(function () { + var pufferchick = $("#pufferchick"); + $(".download").each(function (index, element) { + $(element).hover(function () { + pufferchick.attr("src", "Content/images/pufferchick-cool.png"); + }, function () { + pufferchick.attr("src", "favicon.ico"); + }) + }); +}); |