Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save malachi358/d6c6c555a14df93eaa579aadda13b8cc to your computer and use it in GitHub Desktop.
Save malachi358/d6c6c555a14df93eaa579aadda13b8cc to your computer and use it in GitHub Desktop.
Change place of divs in dom based on width of device
// Change place of divs in dom based on width of device ================================
$(window).resize(function(){
resize();
});
$(document).ready(function(){
resize();
});
function resize(){
if($(window).width() < 767)
{
//Mobile
$(".sidebar").insertAfter(".section.product_section");
}
else
{
//Desktop
//Leave original layout
$(".sidebar").insertBefore(".content .twelve.columns");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment