Try
jQuery(function () {
var flag;
$(window).resize(function () {
var bodyWidth = $(window).width();
console.log(bodyWidth)
if (flag !== false && bodyWidth < 740) {
//move the element to new location
console.log('less')
flag = false;
} else if (flag !== true && bodyWidth >= 740) {
//put it back to original location
console.log('more')
flag = true;
}
}).resize();
})
Demo: Fiddle