SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    detecting if an element is floating into another element

    Is there a way to find out if paragraph x has any floating elements overlapping it.

    for example, if you look at the following HTML:

    <div>
    <img src="" style="float:left;" />
    <p>some text</p>
    <p> some more text</p>
    </div>

    Because the image is floating, then the text will be displaying around it. Once the height of the image is reached, any paragraphs further down the page will not have the image floating inside of it. Is there any way I can detect whether this is happening to a element on the page?

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,076
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    You'd have to compare the height of the image with the height of the paragraph when the page is loaded (you could google for a function to get the height of an element).

    Why do you want to do this?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •