I want to take each div with class of top and insert inside the div with a class of .blurb...Problem is that it adds too many repeated elements and crashes the page..Here is a code below
<div class="top">top1</div>
<div class="top">top2</div>
<div class="top">top3</div>
<div class="blurb">
<p>Blurb Copy</p>
<p>Blurb Copy</p>
<p>Blurb Copy</p>
</div>
<div class="blurb">
<p>Blurb Copy</p>
<p>Blurb Copy</p>
<p>Blurb Copy</p>
</div>
<div class="blurb">
<p>Blurb Copy</p>
<p>Blurb Copy</p>
<p>Blurb Copy</p>
</div>
function sizeUpdate() {
var width = $(window).width(); // Get window width
var height = $(window).height(); // Get window height
$('.top').each(function(){
if (width < 993) {
$(this).insertAfter('.blurb');
} else if (width > 992) {
$(this).insertBefore('.blurb');
}
});
};
$(document).ready(sizeUpdate); // When the page first loads
$(window).resize(sizeUpdate); // When the browser changes size