m |
m |
||
Line 91: | Line 91: | ||
var navigationBar = document.getElementById("navigation-bar"); | var navigationBar = document.getElementById("navigation-bar"); | ||
− | + | if (window.matchMedia("(min-width: 768px)").matches) { | |
+ | /* the viewport is at least 768pixels wide */ | ||
+ | if (document.body.scrollTop > 339 || document.documentElement.scrollTop > 339) { | ||
navigationBar.classList.add("opaque-nav"); | navigationBar.classList.add("opaque-nav"); | ||
} else { | } else { | ||
navigationBar.classList.remove("opaque-nav"); | navigationBar.classList.remove("opaque-nav"); | ||
} | } | ||
+ | } else { | ||
+ | /* the viewport is less than 768pixels wide */ | ||
+ | } | ||
} | } | ||
</script> | </script> | ||
+ | |||
+ | |||
</head> | </head> | ||
<header> | <header> |
Revision as of 07:13, 6 October 2016