码迷,mamicode.com
首页 > 其他好文 > 详细

getBoundingClientRect用法

时间:2017-09-15 13:50:00      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:ott   otto   height   get   nbsp   bsp   cli   top   用法   

getBoundingClientRect()表示元素相对于视窗的集合,left、right、top、bottom(元素的位置)等属性

也可以得到元素的width和height

如: objRect = obj.getBoundingClientRect();

   left = objRect.left;

   right = objRect.right;

   top = objRect.top;

   bottom = objRect.bottom;

   width = right - left;

   height= bottom - top;

  

getBoundingClientRect用法

标签:ott   otto   height   get   nbsp   bsp   cli   top   用法   

原文地址:http://www.cnblogs.com/huanbaby/p/7525734.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!