简体   繁体   English

jQuery在Internet Explorer 8中未正确执行

[英]jquery not properly executed in internet explorer 8

I have a page with header and footer div height set to 100px, and I made a simple jquery function that makes the central element change its height on browser resize, so that the page is always 100% of the viewport tall. 我有一个页眉和页脚div高度设置为100px的页面,并且我做了一个简单的jquery函数,该函数使中心元素在浏览器调整大小时更改其高度,因此该页面始终是视口高度的100%。

//resize
function resize_scroll_pane() { 
    var dynamic_height = $(window).height() - ($(".navbar").outerHeight() + $(".footer").outerHeight());
    $(".scroll-pane, .items, .items img").css("height",dynamic_height + "px");
}

$(document).ready(function() {
    resize_scroll_pane();
    $(window).bind('resize', resize_scroll_pane);
});

It works like a charm in all browsers except in IE8. 除了IE8,它在所有浏览器中的作用都非常吸引人。 Can anyone help me figure out why? 谁能帮我找出原因? I'm using jquery 1.11.1 which should be IE8 compatible, and I also included html5shiv.min.js and respond.min.js to expand IE8's functionality. 我正在使用应该与IE8兼容的jquery 1.11.1,并且还包括html5shiv.min.js和response.min.js来扩展IE8的功能。

$(window).scroll(resize_scroll_pane);
$(window).resize(resize_scroll_pane);

you may use both of them. 您可以同时使用它们。 Its working for me in IE8. 它在IE8中为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM