Forums

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

Home Forums JavaScript Dynamic Sidebar Height / Content Loading, Based on Page Height

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30617
    paggap
    Member

    Hello,

    I have a sidebar with, say, 4 content areas. Let’s say each of them are 600px tall. I want the amount of sidebar content areas loaded / displayed for a specific web page to be based on page height:

    * If content is 1200px tall, load 2 of the content areas
    * If content is 1400px tall, load 3
    * If content is 1800px tall, load 3
    * If content is 2200px tall, load 4
    * If content is 2400px tall, load 4
    * Taller than 2400px, load 4

    Not sure the best way to approach this: jQuery, CSS, PHP, JS?

    Any help would be greatly appreciated!

    Thanks,
    Paul

    #77622
    ImpInaBox
    Member

    Probably best to use Javascript. Deliver the whole content of the website – either PHP or fixed HTML pages – and then have a javascript function check the available height and set style.display.none for any content items you don’t have room for. That way the content is still there in the page for search engines to see but the extra bits just won’t be visible if there’s not enough room.

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