Jquery mobile MJQ-方向改变永远不会改变div的高度

Jquery mobile MJQ-方向改变永远不会改变div的高度,jquery-mobile,Jquery Mobile,我需要更改“content”div的高度,因为我使用了这段代码,但它从来都不起作用。。。有什么想法吗 $(window).bind('orientationchange', function() { var screenWidth = $(window).width(); if(screenWidth >= 768){ var the_height = ($(window).height() - $(this).find('[data-role="head

我需要更改“content”div的高度,因为我使用了这段代码,但它从来都不起作用。。。有什么想法吗

$(window).bind('orientationchange', function() { 
    var screenWidth = $(window).width();
    if(screenWidth >= 768){
        var the_height = ($(window).height() - $(this).find('[data-role="header"]').height() - $(this).find('[data-role="footer"]').height());
        $(this).height($(window).height()).find('[data-role="content"]').height(the_height);
    }
});

尤其是我在ipad和平板电脑上使用它。

如果方向更改事件绑定正确,那么它似乎可以正常工作。。。通过将警报消息放置在绑定中进行检查。。。我做了一个通过点击事件改变高度的小例子()

和css以查看差异:

#contentDiv{
    height:20px;
border-width: 5px;
border-spacing: 10px;
border-spacing: 10px;
border-image: initial;
border-color: red;   
line-height: 34px;
border-left: solid 1px #95C864;
border-right: solid 1px #74AE3B;
border-left: solid 1px rgba(255, 255, 255, 0.3);
border-right: solid 1px rgba(0, 0, 0, 0.1);
background:green;
}
并在此处检查高度设置 ​

@3gwebtrain:我觉得如果方向改变事件绑定正确,那么改变div的高度也不是什么大事。(请通过警报或日志调试方向改变函数中的每一行代码..这样你就可以发现绑定是否正确,高度是否正确)
$('#contentDiv').click(function(){
    $('#contentDiv').height( $('#contentDiv').height()+20);
});
#contentDiv{
    height:20px;
border-width: 5px;
border-spacing: 10px;
border-spacing: 10px;
border-image: initial;
border-color: red;   
line-height: 34px;
border-left: solid 1px #95C864;
border-right: solid 1px #74AE3B;
border-left: solid 1px rgba(255, 255, 255, 0.3);
border-right: solid 1px rgba(0, 0, 0, 0.1);
background:green;
}