Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Not able to calculate the height of the div.

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #164159
    gowda24
    Participant

    Main div has a bootstrap carousel in it.

    I am trying to fetch the height of the main div using jquery height() .

    Sometimes it gives the correct height of the div, but sometimes i am getting wrong height.

    before the carousel is loaded the height is calculated.

    Calling the jquery height on document ready and on window onload.

    #164160
    gowda24
    Participant

    In IE always getting the wrong height.

    #164161
    Paulie_D
    Member

    Care to show your code?

    We can’t diagnose what we can’t see.

    #164255
    Chromawoods
    Participant

    I could see this happening if your code runs before the carousel has fully initialized. The carousel might inject content into the page after your doc ready. It might explain why it works sometimes. But yeah, hard to say without seeing some code.

    #164265
    mcjohnst
    Participant

    Make sure the element is in a state where height is able to be accurately calculated.

    ex: hidden elements will have a height of 0 until they’re state is changed

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.