Skip to content

Commit 0a183b9

Browse files
committed
Add workaround for reactive dropdown in mobile header
1 parent 13ff3d6 commit 0a183b9

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

themes/vocabulary_theme/templates/layout.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<link rel="shortcut icon" type="image/x-icon" href="{{ '/static/favicon.ico'|url }}">
55
<link rel="stylesheet" href="{{ '/static/gen/style.css'|url }}">
66
<link rel="stylesheet" href="{{ get_pygments_stylesheet()|url }}">
7-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@creativecommons/vocabulary/css/vocabulary.css">
87
<meta property="og:site_name" content="Creative Commons" />
98
<meta property="og:title" content="{{ this.title }}" />
109
{% if this.description %}
@@ -41,7 +40,7 @@
4140

4241
<body>
4342
<div class="ga-script">{{ generate_google_analytics() }}</div>
44-
<header class="bulma">
43+
<header>
4544
<nav class="navbar">
4645
<div class="navbar-brand">
4746
{% set cc_logo = site.get('/').attachments.get('open_source.svg') %}

webpack/js/main.js

+16
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,22 @@ $(document).ready(function () {
1616
$(".navbar-burger").toggleClass("is-active");
1717
$(".navbar-menu").toggleClass("is-active");
1818
});
19+
20+
$(".navbar-item.has-dropdown").click(function() {
21+
if ($(".navbar-burger").is(':visible')) {
22+
$(this).toggleClass("is-active");
23+
}
24+
});
25+
$(".navbar-item > .navbar-link").click(function(e) {
26+
if ($(".navbar-burger").is(':visible')) {
27+
e.preventDefault();
28+
}
29+
});
30+
$(window).resize(function() {
31+
if (!$(".navbar-burger").is(':visible') && $(".navbar-item.has-dropdown.is-active").length) {
32+
$(".navbar-item.has-dropdown.is-active").removeClass('is-active');
33+
}
34+
});
1935
});
2036

2137
const getFullyQualifiedUrl = (path, version) => {

webpack/sass/main.scss

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
@import "../node_modules/@creativecommons/vocabulary/css/vocabulary.css";
2+
13
//Color Variables
24
$pumpkin: #e15803;
35
$orange: #FB7928;
46
$candy: #EE5B32;
57
$jet-black: #333333;
68
$grey: rgba(255, 255, 255, 0.6);
79
$blue: #00b5da;
8-
$white: #fff;
10+
$white: #ffffff;
911

1012
//Color Configs
1113
$brand-theme: $candy;
@@ -15,6 +17,20 @@ $brand-theme-light: $orange;
1517
$text-color: $jet-black;
1618
$project-card-theme: $blue;
1719

20+
21+
.navbar-item {
22+
&.has-dropdown {
23+
.navbar-dropdown {
24+
display: none;
25+
}
26+
&.is-active {
27+
.navbar-dropdown {
28+
display: block;
29+
}
30+
}
31+
}
32+
}
33+
1834
h2 {
1935
font-weight: 600;
2036
padding-bottom: 0.5rem;
@@ -118,4 +134,3 @@ img {
118134
animation:octocat-wave 560ms ease-in-out
119135
}
120136
}
121-

0 commit comments

Comments
 (0)