mirror of
https://github.com/jonom/silverstripe-betternavigator.git
synced 2024-10-22 14:05:51 +02:00
IE8 Compatibility
This commit is contained in:
parent
fdd895ef9d
commit
67ccc1c38f
@ -14,9 +14,7 @@ function getCookie(cname) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do some stuff when the dom is loaded. (Won't work in IE8 or lower)
|
function initialiseBetterNavigator() {
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
|
|
||||||
//Dom elements
|
//Dom elements
|
||||||
var BetterNavigator = document.getElementById("BetterNavigator");
|
var BetterNavigator = document.getElementById("BetterNavigator");
|
||||||
var BetterNavigatorStatus = document.getElementById("BetterNavigatorStatus");
|
var BetterNavigatorStatus = document.getElementById("BetterNavigatorStatus");
|
||||||
@ -32,5 +30,15 @@ document.addEventListener("DOMContentLoaded", function() {
|
|||||||
if (getCookie('BetterNavigator') === 'open') {
|
if (getCookie('BetterNavigator') === 'open') {
|
||||||
BetterNavigator.className = 'open';
|
BetterNavigator.className = 'open';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (document.addEventListener) {
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
//wait til DOM is ready
|
||||||
|
initialiseBetterNavigator();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
//This is the case for IE8 and below
|
||||||
|
//initialise straight away - fine if script is loaded after BN dom element
|
||||||
|
initialiseBetterNavigator();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user