Get bottom and right position of an element

后端 未结 7 870
遇见更好的自我
遇见更好的自我 2020-12-01 00:45

I\'m trying to get the position of an element within the window like so:

var link = $(element);

var offset = link.offset();
var top = offset.top;
var left =         


        
7条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-01 01:14

    var link = $(element);
    var offset = link.offset();
    
    var top = offset.top;
    var left = offset.left;
    
    var bottom = top + link.outerHeight();
    var right = left + link.outerWidth();

提交回复
热议问题