jquery 1.8.3 and Yii: (window).height() = (documen

2019-08-30 08:03发布

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.

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

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?

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.

标签: jquery yii
1条回答
神经病院院长
2楼-- · 2019-08-30 08:14

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>

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.

查看更多
登录 后发表回答