jQuery - Add element before element with .insertBefore()

0 votes
201 views
added Mar 6, 2020 in jQuery by lcjr First Warrant Officer (11,790 points)
if ($('body').hasClass('front') || (dfpInArticleId.css('display') == 'none')) {
  inArticleUnit.hide();
  console.log('front or none');
}
else { 
  if ($(window).width() < 768) {
    inArticleUnit.insertBefore(inArticleInsertM);
    inArticleUnit.show();
  }
  else {
    inArticleInsert.append(inArticleUnit);
    inArticleUnit.show();
  }
  console.log('in-article appear');
}

 

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...