jQuery 1.8.3和Yii:(window).height()=(document).height() [英] jquery 1.8.3 and Yii: (window).height() = (document).height()

查看:100
本文介绍了jQuery 1.8.3和Yii:(window).height()=(document).height()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目适用于Yii 1.1.12(包括jQuery 1.7.2).现在,我尝试更新为Yii 1.1.13(包括jQuery 1.8.3).突然发现$(window).height()现在返回文档高度,而不是窗口高度.

My project works on Yii 1.1.12 (and included jQuery 1.7.2). Now I'm try to update to Yii 1.1.13 (and included jQuery 1.8.3). Suddenly discover than $(window).height() now return the document height, not window.

我正在尝试Yii 1.1.12和jQuery 1.8.3-相同的结果:$(window).height() = $(document).height().但是确实少了$(window).height().

I'm try Yii 1.1.12 and jQuery 1.8.3 - the same result: $(window).height() = $(document).height(). But $(window).height() less, indeed.

返回Yii 1.1.12和jQuery 1.7.2-并获得良好的结果. 没有Yii的jQuery 1.8.3可以正常工作.

Return to Yii 1.1.12 and jQuery 1.7.2 - and have good result. jQuery 1.8.3 without Yii works properly.

是什么意思?为了解决这个问题,我必须朝哪个方向进行研究?

What does it mean? In which direction I must research for solving this problem?

解决方案. 事实证明,我有些文件带有 BOM .因此,它们破坏了<!DOCTYPE html>声明(在本地Windows计算机上),并且jQuery无法与此文档一起正常工作.现在,我从文件中清除BOM,而jQuery可以正常工作.

Solution. It turns out, I have some files with BOM. So, they corrupted <!DOCTYPE html> declaration (on local Windows machine), and jQuery can't works properly with this document. Now I clean BOM from files and jQuery works fine.

推荐答案

以怪癖模式呈现页面时,会发生此问题.参考: http://bugs.jquery.com/ticket/12388

This problem happens when your page is rendered in quirks mode. Reference: http://bugs.jquery.com/ticket/12388

尝试将您的文档类型更改为:

Try changing your doctype to:

<!DOCTYPE HTML>

您说没有Yii的jQuery 1.8.3正常工作.这可能是因为您在非Yii页面上使用了不同的文档类型.

You said that jQuery 1.8.3 without Yii works properly. That might be because you are using a different doctype for your non-Yii page.

这篇关于jQuery 1.8.3和Yii:(window).height()=(document).height()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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