我有这个脚本: https://github.com/Fugiman/Twitch-Channel-Status 我想将它整合到我的wordpress网站中。 但这不起作用。当我用控制台调试它说:
未捕获的TypeError:undefined不是函数
它强调了这一点:
document.refreshTwitchChannelStatuses = function () {
var channels = {};
// Create a mapping of channel name -> images to update based on that channel's status
$("img[" + attribute + "]").each(function () {
var $this = $(this),
channel = $this.attr(attribute).toLowerCase();
channels[channel] = channels[channel] || [];
channels[channel].push($this);
// If there's no image set already, default to offline
if (!$this.attr("src")) {
$this.attr("src", $this.attr("data-offline-image") || offlineImage);
}
});