body.scrollTop已弃用? [英] body.scrollTop is deprecated?

查看:75
本文介绍了body.scrollTop已弃用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jQuery版本1.7.2

我在Google Chrome开发者工具中找到了以下几行:

body.scrollTop is deprecated in strict mode. Please use 'documentElement.scrollTop' if in strict mode and 'body.scrollTop' only if in quirks mode. jquery-1.7.2.min.js:4
body.scrollLeft is deprecated in strict mode. Please use 'documentElement.scrollLeft' if in strict mode and 'body.scrollLeft' only if in quirks mode. jquery-1.7.2.min.js:4
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery-1.7.2.min.js:3

这是错误还是正常?它会影响我的网站吗?

解决方案

您面临的问题是chrome的一般问题.....它使用body.scrollTop表示标准模式下视口的滚动位置. /p>

我能想到的可能原因是chrome的制造商希望开发人员改用更正式或通用的编码风格....对于其他浏览器(例如Mozilla),我认为您的问题不会在那里(您也检查过其他浏览器吗!!?在我的mozilla上看起来还不错.

尝试此修复程序

I am using jQuery version 1.7.2

I found these lines in Google Chrome Developer Tools:

body.scrollTop is deprecated in strict mode. Please use 'documentElement.scrollTop' if in strict mode and 'body.scrollTop' only if in quirks mode. jquery-1.7.2.min.js:4
body.scrollLeft is deprecated in strict mode. Please use 'documentElement.scrollLeft' if in strict mode and 'body.scrollLeft' only if in quirks mode. jquery-1.7.2.min.js:4
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. jquery-1.7.2.min.js:3

Is that an error or is it normal? Does it affect my website?

解决方案

The problem you are facing is general one for chrome.....it uses body.scrollTop to represent the view-port's scroll position in standards mode.

Possible reason i can think of is that the makers of chrome want the developers to switch to more formal or universal style of coding....as for other browsers like Mozilla, I don't think your problem would be there (have you checked in other browsers too !!? looks fine on my mozilla.

Try this Fix

这篇关于body.scrollTop已弃用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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