Skip to content

Instantly share code, notes, and snippets.

@clarknelson
Created December 1, 2017 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarknelson/623b2a72283e437a3b577317bec92fe1 to your computer and use it in GitHub Desktop.
Save clarknelson/623b2a72283e437a3b577317bec92fe1 to your computer and use it in GitHub Desktop.
Reorder elements after a certain breakpoint
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