是什么导致 Javascript 在严格模式下的 IE 中停止工作

发布于 2024-12-07 10:44:57 字数 258 浏览 6 评论 0原文

我正在尝试调试我的 jQuery 插件,它在 IE 中运行良好,直到我添加 。它在除 IE 之外的所有浏览器中仍然可以正常工作sigh(在 6、7、8 中测试)。什么样的事情可能导致这种情况?

这是页面: http://liime.net/projects/liimeBar/demo.html

I'm trying to debug my jQuery plugin and it worked fine in IE until I added <!doctype html>. It still works fine in all browsers except IE sigh (tested in 6,7,8). What sort of thing could be causing this?

here is the page: http://liime.net/projects/liimeBar/demo.html

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

十雾 2024-12-14 10:44:57

你在constructScrollers()中的条件
window.innerHeight <; $('body')[0].scrollHeight
为 false,因为在 IE8 中这两个值是相同的。
所以没有创建滚动条

在 jQuery 中做一些研究,你会找到正确的函数如何获得你想要测试的高度。

其中有很多代码,如果您使用更多 jQuery 函数而不仅仅是选择器,效果可能会更好。

- 编辑
试试这个
$(窗口).height() < $('body').height()

PS:通过这个脚本,你只能为正文制作一个滚动条,因为你对正文进行了硬编码。尝试 $(this) 相反,这是您调用 liimebar() 函数的对象,并且不要在 liimebar_buttons、..bar 等上使用 id,而是在类上使用,因此您可能拥有比滚动条更多的内容。

Your condition in constructScrollers()
window.innerHeight < $('body')[0].scrollHeight
is false, bacause both values are the same in IE8.
So no scrollers are created

Do some research in jQuery that you find the proper function how to get the heights you want to test.

You have much code in it, that could be better if you used more jQuery functions, not just the selectors.

--edit
try this instead
$(window).height() < $('body').height()

P.S.: By this script you can only make a scrollbar for the body, because you hard coded the body. try $(this) instead, which is the object you called your liimebar() function with and don't use ids on liimebar_buttons, ..bar etc, but classes, so you could possibly have more than on scrollbar.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文