Skip to content
This repository was archived by the owner on Dec 27, 2017. It is now read-only.

Commit 9ba9bba

Browse files
author
Tony Yip
committed
Fix Issue opensourcehk#41
1 parent 807a33d commit 9ba9bba

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

src/css/_navbar.scss

+10
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@
2525
}
2626
}
2727

28+
@media (min-width: 768px) and (max-width: 993px) {
29+
.navbar .dropdown-menu a {
30+
color: #333 !important;
31+
}
32+
33+
.navbar-front .dropdown-menu {
34+
background-color: $white;
35+
}
36+
}
37+
2838
@media (min-width: 992px) {
2939
.navbar.affix-top {
3040
bottom: 0;

src/scripts/client.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var store = Store({
2727
});
2828

2929
let ticketDiv = document.getElementById('ticket');
30-
if ((typeof ticketDiv != "undefined") && (ticketDiv != null)) {
30+
if ((typeof ticketDiv !== "undefined") && (ticketDiv !== null)) {
3131
render((
3232
<TicketButton
3333
className="btn btn-lg btn-hkosc button-front-mobile-ticket"
@@ -39,7 +39,7 @@ if ((typeof ticketDiv != "undefined") && (ticketDiv != null)) {
3939
}
4040

4141
let timetableDiv = document.getElementById('timetable');
42-
if ((typeof timetableDiv != "undefined") && (timetableDiv != null)) {
42+
if ((typeof timetableDiv !== "undefined") && (timetableDiv !== null)) {
4343
console.log("run here");
4444
render((
4545
<Provider store={store}>

src/scripts/utils/navBar.js

+22-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
'use strict';
22

3-
export default function () {
3+
var largeScreen = screen.width > 993;
44

5-
!function () {
6-
let $navbar = $('.navbar-front');
7-
if ($navbar.length === 0) return;
8-
let drop = $('#navbar-collapse', $navbar);
9-
$navbar.affix({
10-
offset: {
11-
top: $('.jumbotron').height() + $navbar.height()
12-
}
13-
});
14-
$navbar.on('affixed.bs.affix', function () {
5+
export default function () {
6+
let $navbar = $('.navbar-front');
7+
if ($navbar.length === 0) return;
8+
let drop = $('#navbar-collapse', $navbar);
9+
if (!largeScreen)
10+
drop.removeClass('dropup');
11+
$navbar.affix({
12+
offset: {
13+
top: $('.jumbotron').height() + $navbar.height()
14+
}
15+
});
16+
$navbar.on('affixed.bs.affix', function () {
17+
if (largeScreen)
1518
drop.removeClass('dropup');
16-
});
17-
$navbar.on('affixed-top.bs.affix', function () {
19+
});
20+
$navbar.on('affixed-top.bs.affix', function () {
21+
if (largeScreen)
1822
drop.addClass('dropup');
19-
});
20-
}(jQuery);
23+
});
24+
25+
$(window).resize(function () {
26+
largeScreen = screen.width > 993;
27+
});
2128
}

0 commit comments

Comments
 (0)