JQuery: check if element is in normal flow

前端 未结 3 762
傲寒
傲寒 2021-02-07 05:05

What is the most elegant way to check whether an element is in the normal flow using jQuery?

According to the CSS3 specification,

A box belongs t

3条回答
  •  失恋的感觉
    2021-02-07 05:14

    I doubt theres a better way, but a different way would be:

    1) Surround the element with a wrapper

    2) Compare height and width of wrapper with wrapped element

    For example:

    $('#elementToTest').clone().addClass('clone').wrap('
    ') if($('#elementToTest.clone').height()>$('#elementToTest.clone').parent().height()){ //outside the normal flow }

提交回复
热议问题