Created
January 24, 2020 01:54
-
-
Save eldoy/f3ee2bf5790e85bc8375ae58b6f9536f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adaptFooter(x) { | |
var nav = document.querySelector('.navigation.mobile_block') | |
if (x.matches) { | |
var links = document.querySelectorAll('#footer li') | |
console.log(links) | |
var list = document.createElement('ul') | |
list.setAttribute('id', 'mobile-footer') | |
links.forEach(function(li) { | |
list.appendChild(li.cloneNode(true)) | |
}) | |
nav.appendChild(list) | |
} else { | |
var mobileFooter = document.querySelector('#mobile-footer') | |
if (mobileFooter) mobileFooter.remove() | |
} | |
} | |
var x = window.matchMedia("(max-width: 960px)") | |
adaptFooter(x) | |
x.addListener(adaptFooter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment