• The plugin seems to work fine overall but the javascript console raises the following error in every page where the banners are displayed: Uncaught TypeError: Cannot read property 'left' of undefined - frontend.js line 44.

    This is the function that is causing the error (third line):

    function logging_ads(){
    
    	$('.aas_wrapper').each(function(){
    		if( isVisible( jQuery(this).children() ) && jQuery(this).offset().left == jQuery(this).closest('.caroufredsel_wrapper').offset().left && viewed[jQuery(this).data('ads')] != 1 ){
    		viewed[jQuery(this).data('ads')] = 1;
    		var data = {
    		action : 'aas_view_log',
    		nonce : jQuery(this).data('nonce'),
    		data : jQuery(this).data('ads'),
    		c_url : window.location.href
    		};
    		jQuery.post(ajax.url,data,function(response){});
    		}
    	});
    }

    Any ideas of what can be the reason and how to correct it? Otherwise great plugin, very simple to use in comparison to other advertising plugins.

    This is the website I’m working on: http://indumentat.com/

    https://ww.wp.xz.cn/plugins/advanced-advertising-system/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author smartdevth

    (@smartdevth)

    Perhaps, the caroufredsel wrapper didn’t exist because the error you’ve shown noticed that getting offset() of undefined.

    Did any js errors occur before mine?

    I will deeply check your site when Im home.

    Best regard,
    Smartdevth

    Thread Starter Sandra Sanz

    (@sandra-sanz)

    Thanks for answering!

    This is weird, I swear yesterday there was only that error again and again (it seemed to happen every time a banner would rotate, because they stacked in the console as time went by) but now it only happens every now and then and when it happens, it does only once.

    There’s another javascript error happening in the frontpage sometimes that is cannot call methods on isotope prior to initialization; attempted to call 'layout' but that seeems to be unrelated to the plugin, they’re template functions.

    It could be related to caroufredsel not loading properly yesterday for some reason and now it only happens if for some reason the plugin functions load and start before the caroufredsel functions have loaded.

    In short I can’t put my finger on what and when it’s failing and it doesn’t seem to cause any problems so… I’ll get back to you if I collect any more info.

    I’m the same person, I don’t have access to my other account right now.

    I noticed the error just happens when there’s an ad where both the featured image and the extended html field are left blank. When I first wrote this message, it didn’t seem to cause any major issues, but later it happened to break several plugins that used javascript.

    I think the issue is caused in the isVisible() function, when it tries to get the left and top offset of the empty ad.

    I guess empty ads shouldn’t exist, but if this issue is reproducible in other environments I think it should be bulletproofed just in case. I think my clients delete old images pertaining to old ads that they think they don’t have use for anymore, and that’s when it breaks.

    Plugin Author smartdevth

    (@smartdevth)

    Ok, I will improve isVisible function to check if there is empty ad.

    Great! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Javascript error on frontend.js’ is closed to new replies.