From cc819d2624e07df28791b5877a0ec91b3872d62d Mon Sep 17 00:00:00 2001 From: unknown <zack@wongbox.internal.wongworks.net> Date: Fri, 3 Jan 2020 12:28:40 +0800 Subject: [PATCH] animate navbar dropdown --- src/static/base.js | 16 ++++++++++++++++ src/templates/base.html | 1 + 2 files changed, 17 insertions(+) create mode 100644 src/static/base.js diff --git a/src/static/base.js b/src/static/base.js new file mode 100644 index 0000000..8a68b59 --- /dev/null +++ b/src/static/base.js @@ -0,0 +1,16 @@ +$(function() { + + $('.dropdown-toggle').on('click', function(event) { + $('.dropdown-menu').slideToggle(50); + event.stopPropagation(); + }); + + $('.dropdown-menu').on('click', function(event) { + event.stopPropagation(); + }); + + $(window).on('click', function() { + $('.dropdown-menu').slideUp(50); + }); + +}); \ No newline at end of file diff --git a/src/templates/base.html b/src/templates/base.html index 4776dcb..2797bd2 100644 --- a/src/templates/base.html +++ b/src/templates/base.html @@ -23,6 +23,7 @@ <link rel="stylesheet" type="text/css" href="{% sass_src 'shared.scss' %}"/> <link rel="stylesheet" type="text/css" href="{% sass_src 'base.scss' %}"/> <link rel="stylesheet" type="text/css" href="{% static 'memberdb.css' %}"/> + <script src="{% static 'base.js' %}"></script> <script src="https://unpkg.com/feather-icons"></script> {% block prestyle %}{% endblock %} {% block extrahead %}{% endblock %} -- GitLab