' + ad_content + ''; var found = false; var last_found; $('div#article-content > p.body').each(function(){ last_found = $(this); if ( $(this).offset().top >= target_offset ) { $(this).after( ad_content ); found = true; return false; } }); if ( found == false && typeof last_found !== 'undefined' ) { $(last_found).after( ad_content ); } target_offset = target_offset + 1000; } } var ad_content = ``; ad_content = ad_content.replace("SCRIPTEND", "' + ad_content + ''; var found = false; var last_found; $('div#article-content > p.body').each(function(){ last_found = $(this); if ( $(this).offset().top >= target_offset ) { $(this).after( ad_content ); found = true; return false; } }); if ( found == false && typeof last_found !== 'undefined' ) { $(last_found).after( ad_content ); } } } var ad_content = ``; ad_content = ad_content.replace("SCRIPTEND", "' + ad_content + ''; var found = false; var last_found; $('div#article-content > p.body').each(function(){ last_found = $(this); if ( $(this).offset().top >= target_offset*2 ) { $(this).after( ad_content ); found = true; return false; } }); if ( found == false && typeof last_found !== 'undefined' ) { $(last_found).after( ad_content ); } } } var ad_content = ``; ad_content = ad_content.replace("SCRIPTEND", "' + ad_content + ''; var found = false; var last_found; var target_offset = 1000; $('div#article-content > p.body').each(function(){ last_found = $(this); if ( $(this).offset().top >= target_offset ) { $(this).after( ad_content ); found = true; return false; } }); if ( found == false && typeof last_found !== 'undefined' ) { $(last_found).after( ad_content ); } } } var ad_content = ``; ad_content = ad_content.replace("SCRIPTEND", "' + ad_content + ''; var found = false; var last_found; var target_offset = 2000; $('div#article-content > p.body').each(function(){ last_found = $(this); if ( $(this).offset().top >= target_offset ) { $(this).after( ad_content ); found = true; return false; } }); if ( found == false && typeof last_found !== 'undefined' ) { $(last_found).after( ad_content ); } } } $(".second_ready").click( function(){ var that = $($(this).children()[0]); var pos = null; if(that.attr('ccposition')) { pos = that.attr('ccposition'); } else { var parent = that.parent(); if(parent.attr('ccposition')){ pos = parent.attr('ccposition'); } else { parent = parent.parent(); pos = parent.attr('ccposition'); } } window.dataLayer.push({ 'ccSponsor': that.attr("ccsponsor"), 'ccZoneID': that.attr("cczoneid"), 'ccSize': that.attr("ccsize"), 'ccId': that.attr("ccid"), 'ccPosition': pos, 'ccType': 'Click' }); }); $(".second_ready").each(function() { var that = $($(this).children()[0]); // element is now visible in the viewport var pos = null; if(that.attr('ccposition')) { pos = that.attr('ccposition'); } else { var parent = that.parent(); if(parent.attr('ccposition')){ pos = parent.attr('ccposition'); } else { parent = parent.parent(); pos = parent.attr('ccposition'); } } window.dataLayer.push({ 'event': 'webccImpression', 'ccSponsor': that.attr("ccsponsor"), 'ccZoneID': that.attr("cczoneid"), 'ccSize': that.attr("ccsize"), 'ccId': that.attr("ccid"), 'ccPosition': pos, 'ccType': 'Impression' }); }); var offset = $('#article-content p:nth-of-type(5)').offset(); console.log(offset); offset.left = offset.left + ($('#article-content p:nth-of-type(5)').width() / 3); $('#blurred-signup').offset(offset); $(function() { $('#peer-reviewed').tipsy({ fade: true, gravity: 'w' }); }); });