function addDynamicContent() { var css = ` .studytextgzbox { background: #F9F9F9; border: 1px solid #999999; margin: 1px; text-align:center; float: left; line-height: 18px; height: 18px; overflow: hidden; width: 206px; } .zzbuluoled:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } @media (max-width: 568px) { .zzbuluoled { display: none; } } `; var style = document.createElement("style"); style.type = 'text/css'; style.innerHTML = css; document.head.appendChild(style); var html = `
`; var container = document.createElement("div"); container.innerHTML = html; document.body.appendChild(container); jQuery(function() { var masonryContainer = jQuery('#masonry'); masonryContainer.imagesLoaded(function() { masonryContainer.masonry({ itemSelector: '.studytextgzbox', gutter: 0, isAnimated: true, }); }); }); } addDynamicContent();