Javascript "——未定义"错误
Javascript "--- is Not Defined" Error
我有这个函数"resizePortfolio",我稍后调用它"resizePortfolio();"但是控制台显示"未捕获的ReferenceError: resizePortfolio未定义"。这是为了让我的幻灯片响应,但由于某种原因,它给出了一个错误,我不明白为什么…
我真的很感激你的帮助。function resizePortfolio() {
slideshowTitleHeight = $('.slideshow_title').height() + 20;
slideshowControlsHeight = $('.slideshow_controls').height() + 20;
if (showFullScreen == true) {
_w = $('#wrapper').width() - (slideshowPaddingLeft + slideshowPaddingRight); // width for the slideshow item
} else {
_w = $('#wrapper').width() - menuWidth - (slideshowPaddingLeft + slideshowPaddingRight); // width for the slideshow item
}
_h = $('#content').height() - (slideshowPaddingTop + slideshowPaddingBottom + slideshowControlsHeight + slideshowTitleHeight); // height for the slideshow item
$('.slideshow, .slideshow li, .slideshow li, .slideshow li table, .slideshow li table td').css({'width':_w, 'height':_h});
$('.slideshow li table td img').css({'max-height':_h,'max-width':_w});
$(slideshowContainer).children('li').each(function() {
_imgH = $(this).find('img').height(); // height for the slideshow image
_imgW = $(this).find('img').width(); // width for the slideshow image
if ($(this).hasClass('assettype2')) {
hasVideo = true;
}
// position for the share overlay
if (hasVideo == true) {
$(slideshowShareContainer, this).height(_h).width(_w);
$(slideshowShareContainer, this).children('div').height(_h).width(_w);
$('.slideshow_share_links', this).width(_w/2);
var margin = _w/2;
var marginTop = (_h/2) - (_h/2);
$(slideshowShareContainer, this).css({'marginLeft': -margin});
} else {
$(slideshowShareContainer, this).height(_imgH).width(_imgW+1);
$(slideshowShareContainer, this).children('div').height(_imgH).width(_imgW);
$('.slideshow_share_links', this).width(_imgW/2);
$('.slideshow_share_links.blog', this).width(_imgW);
var margin = _imgW/2;
var marginTop = (_h/2) - (_imgH/2);
$(slideshowShareContainer, this).css({'marginLeft': -margin});
}
});
}
确保调用:
$(window).on("resize", resizePortfolio);
在$(document).ready(function() {...})
体内,因为函数名的作用域就是那个函数。
相关文章:
- 铬:“;未捕获的语法错误:意外的标记:"
- 可以设置“;文件名"发生错误时显示的内联脚本标记的
- "未捕获的语法错误:意外的标记}"
- Soundcloud api"未捕获的类型错误:无法读取属性'uri'“未定义”;
- 为什么我会出现此错误"未捕获引用错误:未定义标题;
- "未捕获的语法错误:意外的标记"角度JS
- 内联javascript与"<脚本>"字符串错误地关闭了脚本标记
- jquery validate 1.8.1”;jQuery"是未定义的错误IE8
- "资源不足错误“;当从Chrome控制台重复发出ajax请求时
- "未捕获类型错误/丢弃意外“;因为一句台词而出现?(HTML w/<脚本>)
- 我该如何解决“;未捕获引用错误:谷歌没有定义"?(谷歌地图API)
- "未捕获的语法错误:意外的标记<"当尝试使用谷歌'核心报告API
- 用分隔符分隔具有多个整数值的字符串的Javascript"重试错误的值
- 语法错误:"意外的标记<"在Web控制台中
- "所请求的名称已经作为不同类型的“”存在;HTTP 409响应错误
- "responsed_to|format|“;引发UnknownFormat错误
- 为什么我得到“;错误:预期"同时访问字符串
- "未定义不是函数“;错误jQuery,.replaces,scrollTop
- 我收到一个类型错误,其中包含-"$不是函数“;使用noConflict时
- "属性描述必须是对象“”;错误