Finding the position of bottom of a div with jquery

前端 未结 8 638
粉色の甜心
粉色の甜心 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 19:01

    This is one of those instances where jquery actually makes it more complicated than what the DOM already provides.

    let { top, bottom, height, width, //etc } = $('#bottom')[0].getBoundingClientRect();
    return top;
    
    0 讨论(0)
  • 2020-12-07 19:08

    use this script to calculate end of div

    $('#bottom').offset().top +$('#bottom').height()
    
    0 讨论(0)
提交回复
热议问题