Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thierrypigot
Created October 17, 2017 08:02
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 thierrypigot/3f01845a244502a34a77f892cddb032f to your computer and use it in GitHub Desktop.
Save thierrypigot/3f01845a244502a34a77f892cddb032f to your computer and use it in GitHub Desktop.
jQuery move bloc when you resize the window.
// Example here: www.sesame-consultants.com/nos-services/etudes-et-investigations/
(function($) {
"use strict";
function wearewp_resize(){
var cta = $('.container-cta');
if( window.matchMedia("(max-width: 991px)").matches ) {
$('.service').after( cta );
}else{
$('.before-cta').after( cta )
}
}
$(window).resize(function(){
wearewp_resize();
});
$(document).ready(function() {
wearewp_resize();
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment