Created
December 1, 2017 03:55
-
-
Save clarknelson/623b2a72283e437a3b577317bec92fe1 to your computer and use it in GitHub Desktop.
Reorder elements after a certain breakpoint
This file contains hidden or 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
cmap.footer = {}; | |
cmap.footer.checkForLayoutChange = function(){ | |
var $footer = $('#footer'), $row = $footer.find('.row'); | |
var $jump = $footer.find('.footer-jump-to-top'); | |
var $pages = $footer.find('.footer-page-links'); | |
var $social = $footer.find('.footer-social-links'); | |
function clean(){ | |
$jump.remove(); | |
$pages.remove(); | |
$social.remove(); | |
} | |
function desktop(){ | |
clean(); | |
$row.append($jump); | |
$row.append($pages); | |
$row.append($social); | |
} | |
function mobile(){ | |
clean(); | |
$row.append($pages); | |
$row.append($jump); | |
$row.append($social); | |
} | |
function check(){ | |
if(window.innerWidth < 1000){ | |
mobile(); | |
} else { | |
desktop(); | |
} | |
} | |
check(); | |
$(window).resize(_.throttle(check, 100)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment