Detaching and AppendingTo on Window Resize
===

So I am trying to detach and appendTo a div based on window size. The following is what I currently have. 

 I am creating a function with a variable SOCIALBAR assigning it equal to #SOCIALMEDIA and detaching it.  Then based on window size for (document).ready and (window).resize, I call the SOCIALBARPlACEMENT function and #SOCIALMEDIA is either appendeto the #TOP or #LEFT divs.

This works fine and dandy on (document).ready but does not work for (window).resize. 

In fact, if I remove document.ready, and leave window.resize, the function still runs on page load, but doesn't work on page resize.

Any thoughts would be appreciated.  Thank!  


`function socialbarplacement(){
		var socialbar;
		socialbar =	$("#socialmedia").detach();`

	if(jQuery(window).width() < 1384) {
		socialbar.appendTo("#top");
		}
	else {
		socialbar.appendTo("#left");
	}
	};

	$(document).ready(socialbarplacement());
	$(window).resize(socialbarplacement());

</script>`

