Finding the position of bottom of a div with jquery

前端 未结 8 661
粉色の甜心
粉色の甜心 2020-12-07 18:29

I have a div and want to find the bottom position. I can find the top position of the Div like this, but how do I find the bottom position?

var top = $(\'#bo         


        
8条回答
  •  被撕碎了的回忆
    2020-12-07 18:45

    The answers so far will work.. if you only want to use the height without padding, borders, etc.

    If you would like to account for padding, borders, and margin, you should use .outerHeight.

    var bottom = $('#bottom').position().top + $('#bottom').outerHeight(true);
    

提交回复
热议问题