Image Load Test

by Ben Clayton

HTML

<img src="//infxsolutions.com/dyn/_smallads//sexy-icons-single-view.png" />
<img src="//infxsolutions.com/dyn/_smallads//sexy-icons-single-viewXXX.png" />
<div class="slick-track" style="opacity: 1; width: 1302px; transform: translate3d(0px, 0px, 0px);"><div class="slick-slide slick-active" data-slick-index="0" aria-hidden="false" style="width: 217px;">

		<div onclick="load_page('/marketing/');" class="infx-small-focus-shell normal small-focus-0">
			<div class="small-focus-container" style="background-image: url('//infxsolutions.com/dyn/_smallads//sexy-icons-design.png')">
				<div class="small-focus-icon"></div>
				<div class="small-focus-title">
					<h2>Design &amp; UX</h2>
				</div>
				<div class="small-focus-motion">
					<div class="small-focus-content">
						<h3></h3>
						<h4>Look good online</h4>
						<div class="small-focus-button">
							<div class="infx-button">
								<a class="block-link" href="/marketing/" title="Look good online" target="_self">
								<span class="button-text"></span>
								<span class="button-icon"></span>
								</a>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		</div><div class="slick-slide slick-active" data-slick-index="1" aria-hidden="false" style="width: 217px;">

		<div onclick="load_page('/marketing/crm-strategy/');" class="infx-small-focus-shell normal small-focus-1">
			<div class="small-focus-container" style="background-image: url('//infxsolutions.com/dyn/_smallads//sexy-icons-strategyxxxx.png')">
				<div class="small-focus-icon"></div>
				<div class="small-focus-title">
					<h2>Content Strategy</h2>
				</div>
				<div class="small-focus-motion">
					<div class="small-focus-content">
						<h3></h3>
						<h4>Be seen online</h4>
						<div class="small-focus-button">
							<div class="infx-button">
								<a class="block-link" href="/marketing/crm-strategy/" title="Be seen online" target="_self">
								<span class="button-text"></span>
								<span...

JavaScript

$("div").each(function(idx){
  if ($(this).css('background-image') != 'none'){
    var path = $(this).css('background-image');
    var m = path.match(/url\("(.*?)"\)/);
    path = m[1];
    $('#hidden').append("<img id='xx"+idx+"' src='"+path+"' />");
  	var w=$('#xx'+idx)[0].naturalWidth;
    if(w==0){
    	console.log("Duff background: "+path);
    } 
  }
});
$("img").not("#hidden img").each(function(idx){
  	var w=this.naturalWidth;
    if(w==0){
    	console.log("Duff img: "+$(this).attr('src') );
    } 
});