Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
$(window).on('resize', function(){ self.setDimensions(); });
未捕获的类型错误:对象 # 没有“on”方法
为什么只有谷歌浏览器会抛出这个错误?我该如何解决?
此处无需使用事件委托 ( on)。只需将resize事件直接绑定到窗口:
on
resize
$(window).resize(function () { self.setDimensions(); });
使用旧版本的 jQuery (1.6.4) 时,我可以复制您的错误。
尝试确保您使用的是最新版本的 jQuery,而不是旧的,可能是缓存的版本。