使用引导轮播脚本无法读取未定义的属性“offsetWidth" [英] Getting Cannot read property 'offsetWidth' of undefined with bootstrap carousel script

查看:34
本文介绍了使用引导轮播脚本无法读取未定义的属性“offsetWidth"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用 Bootstrap 3.3 创建了一个 carousel 并且它可以在我的本地机器上运行,但是当我将整个东西上传到服务器上时,bootstrap js 文件被编译在一起与单个文件中的其他文件,我收到此错误:

I created a carousel with Bootstrap 3.3 and it works on my local machine, but when I upload the whole thing on server where the bootstrap js file is being compiled together with other files in a single file, I get this error:

无法读取未定义的属性offsetWidth" - 有没有人遇到过这个问题,是否有任何已知的解决方案?

Cannot read property 'offsetWidth' of undefined - has anybody faced this and are there any known solutions to this issue?

推荐答案

对我来说这是因为我没有在任何幻灯片上设置 active 类.

For me it was because I hadn't set an active class on any of the slides.

这篇关于使用引导轮播脚本无法读取未定义的属性“offsetWidth"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆