在IE中获取Div的正确高度

时间:2016-07-14 17:01:05

标签: javascript jquery html internet-explorer

请参阅下面的图片。我需要在IE Developer Tools Layout窗口(893.79)的中心框中显示高度值。我尝试了各种各样的方法来获得这个价值而没有成功。 IE继续给我473的价值。我试过...... getElementByID('navigation').offsetHeightclientHeightscrollHeight。我尝试过jquery' .innerHeight(true)outerHeight(true)。 有任何想法吗?谢谢你的时间。

enter image description here

行。希望我不要把这种情况混为一谈。这是我的HTML:



A <div> at the top of the page:
<div id="yui-main" set-height> ==> set-height is my directive
.....
.....
<div id="navigation" class="yui-b" ng-controller="commonController" >  
	==> class="yui-b" has the following css values: width: 23em; float: left; margin: 0; padding: 0;
    <div id="InfoByTopic"> ==> has the following css: a url pointing to a jpg for background; padding-bottom: 2px
	.........
    </div>
    
    <div id = "InfoByState">  ==> has the following css values: margin: 0; padding: 0; box-sizing: content-box;
        <form action="${pageContext.request.contextPath}/resource/state" method="POST">
		.......
        </form>
    </div>

    <h2 class="invisible">Some Info Here</h2>
    <ul id="hotxxx"> ==> has the following css values: a url pointing to a jpg for background; padding-bottom: 2px;
							margin: 0; padding: 0 0 0 .75em;
        <li><a target="_blank" href="http://www.xxxxx.net" title='blah blah'><font color="#0000CC"><span>Some Stuff Here</span></font></a>SOME NONSENSE HERE</li>
        <li><a target="_blank" href="http://www.YYYY.aspx" title='blah blah'><font color="#0000CC"><span>More Stuff Here</span></font></a>MORE NONSENSE HERE</li>
    </ul>
</div>
&#13;
&#13;
&#13;

这是我的角度指令,在那里我得到了导航的高度&#39; DIV:

&#13;
&#13;
    myApp.directive('setHeight', function($window){
        return{
            restrict: 'A',

            link: function(scope, element, attrs){

                angular.element(document).ready(function() {

                    console.log( "navigation div height: " + document.getElementById('navigation').offsetHeight);
					==>in IE Dev Tools Console:  "navigation div height: 472"
					==>in Chrome Console: "navigation div height: 891"
					

                });

            }
        }
    })
&#13;
&#13;
&#13;

请注意IE(11)与Chrome返回的值? FF返回值895。

0 个答案:

没有答案