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

Home Forums JavaScript Can I set the page height to height of accordion content?

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
  • #29406


    I am trying to find a way of including multiple accordion widgets on one page, and one way would be using iframes. This would solve the problem of having to adapt the accordion js/css code, as each accordion’s code would be kept separate on individual pages pulled into the main page using iframes.

    I would like the height of the iframes to be set dynamically to the height of the content in each of the sections of the accordion, as this will fit with the theme I am using. Basically the main page is a blog and each section of the blog is separated in the theme, into ‘cards’ which resize their height depending on the content. You can see what I mean here:

    I am not using iframes on this page at present. You can see the effect I am looking for by clicking on any of the first four buttons on the first blog entry. The second accordion doesn’t work as I am not sure how to adapt the code to work with multiple accordions. I have asked a question on this forum about this here:


    (of course if I was going to go down this route I wouldn’t be using iframes)

    I have been exploring various methods of dynamically resizing the height of iframes using javascript, but this obviously depends on the height of the pages inserted being set to the height of the accordion content. At the moment I am just getting the same height in the iframes (when using javascript to set the height dynamically), even though the height of the content varies, and I presume this is because the height of the pages is not set to the height of the content of the accordion, so it is this that I need to work out how to do.

    I hope this is clear!


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