scrollTop and doctype
scrollTop and doctype
我正在寻找解决方案,使document.body.scrollTop在使用doctype
时返回正确的值<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
现在这只适用于chrome,而不是在ff和ie
alert('scrollTop = '+document.body.scrollTop);
我认为有两种选择:
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
相关文章:
- Selenium WebDriver and JavaScript change
- PHP and Javascript functions
- Javascript Return and if/else
- SetTimeout and clearTimeout in Javascript
- lightbox in html 5 and javascript
- TimelineJS and AngularJS
- timeago.js with datatable and PHP
- javascript button ajax and php
- Ajax and Json with Rails
- Combine onload, onresize and onclick
- $(document).height和$(window).heaght都返回相同的值-使用的是正确的doctype
- php布尔值's小写AND大写和数字布尔值'可以接受
- setTimeout and V8
- Jquery post and onclick
- Moment js and IOS
- Rails 3.2 and Paloma gem
- Backbone, TypeScript, and super
- JSONP and DOCTYPE Errors
- JavaScript, Doctype, and Firefox
- scrollTop and doctype