startMove函数是我看了视频后推导了一遍。
想着试着用在其他地方看看。刚刚我试了不用getStyle获取top ,直接用offsetTop,发现ie下又可以用了,不解。
Document
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你的代码中
getStyle这个方法在IE下获取到的值是undefined,所以导致在IE下有问题,在IE下,获取到的Ap.currentStyle.top的值是auto,你需要在CSS中写上top:0这样,IE才会获取到top值,从而正确得出getStyle的值,你可以试试。