Forums

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

Home Forums JavaScript Bootstrap parallax site..need JavaScript for window height

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #170517
    rwchampin
    Participant

    Ok so I have a bootstrap parallax site. I’m good at java but minimal JavaScript knowledge. Super super basic. Basically I want to …on loading of the page…to get the height and width of the browser window….and set the 1st slide (section class=”hero”) to fill the whole browser. Examples? Code?

    #170604
    shaneisme
    Participant

    In jQuery, you can use this: $(window).height(); to get the viewport height.

    From there, you can set the height of your .hero something like this:

    var viewport = $(window).height();
    $('.hero').height(viewport);
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.