我在Wordpress上遇到一段jQuery代码问题。无法读取方法split()。
这是代码:
var backImages = jQuery('#backgrounds').data('backgrounds').split(',');
jQuery.backstretch(backImages, {
fade: 500,
duration: 4000
});
if(!jQuery('#color-overlay').length){jQuery('body').addClass('no-overlay');}
我使用控制台检查了代码,我收到以下错误:
未捕获的TypeError:无法读取未定义的属性“split”
在WP之外,脚本可以正常工作。