开发者

Uncaught TypeError: Cannot read property 'id' of undefined

I was working on a site in WordPress. I don't know why, suddenly its giving the error Uncaught TypeError: Cannot read property 'id' of undefined. I tried to do almost every thing. Removed the Plugins, Removed the widgest. But it still complaining for it. Due to it my script is not working.

The error is on line 63 of page, which contains

<link rel="stylesheet" type="text/css" href="http://localhost/hhf/wp-content/plugins/jquery-mega-menu/css/dcjq-mega-menu.css" media="screen" /><script type="text/javascript">/* <![CDATA[ */
        (function($){$.fn.s3Slider = function(vars) { var element = this; var timeOut = (vars.timeOut != undefined) ? vars.timeOut : 4000; var current = null; var timeOutFn = null; var faderStat = true; var mOver = false; var items = $("#" + element[0].id + "Content ." + element[0].id + "Image"); var itemsSpan = $("#" + element[0].id + "Content ." + element[0].id + "Image span"); items.each(function(i) { $(items[i]).mouseover(function() { mOver = true; }); $(items[i]).mouseout(function() { mOver = false;fadeElement(true); }); });var fadeElement = function(isMouseOut) { var thisTimeOut = (isMouseOut) ? (timeOut/2) : timeOut; thisTimeOut = (faderStat) ? 10 : thisTimeOut; if(items.length > 0) { timeOutFn = setTimeout(makeSlider, thisTimeOut); } else { console.log("Poof.."); } }; var makeSlider = function() {current = (current != null) ? current : items[(items.length-1)]; var currNo = jQuery.inArray(current, items) + 1; currNo = (currNo == items.length) ? 0 : (currNo - 1); var newMargin = $(element).width() * currNo; if(faderStat == true) { if(!mOver) { $(items[currNo]).fadeIn((timeOut/6), function() { if($(itemsSpan[currNo]).css('bottom') == 0) { $(itemsSpan[currNo]).slideUp((timeOut/6), function() { faderStat = false; current = items[currNo]; if(!mOver) { fadeElement(false); } }); } else { $(itemsSpan[currNo]).slideDown((timeOut/6), func开发者_C百科tion() { faderStat = false; current = items[currNo]; if(!mOver) { fadeElement(false); } }); } }); } } else { if(!mOver) { if($(itemsSpan[currNo]).css('bottom') == 0) { $(itemsSpan[currNo]).slideDown((timeOut/6), function() { $(items[currNo]).fadeOut((timeOut/6), function() { faderStat = true; current = items[(currNo+1)]; if(!mOver) { fadeElement(false); } }); }); } else { $(itemsSpan[currNo]).slideUp((timeOut/6), function() { $(items[currNo]).fadeOut((timeOut/6), function() { faderStat = true; current = items[(currNo+1)]; if(!mOver) { fadeElement(false); } }); }); } } } }        
    makeSlider();};})(jQuery); jQuery(document).ready(function() { jQuery('#slider').s3Slider({ timeOut: 3000 }); });   /* ]]> */</script>

I am using jQuery Mega Menu widget plugin.


After testing and locating from where it comes, Ultimate Custom Type Manager plugin was generating some scripts, the script file is class-gallery.php so which is generating a script for #slider element which does not exists on the page. Hope some one will fix it soon.

Replaced line 82 of the file class-gallery.php with this code

$r.="jQuery(document).ready(function() { if(jQuery('#slider').length > 0) { jQuery('#slider').s3Slider({ timeOut: 3000 }); } });";

Fixed the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜