I have a single page (scrolling) html. My divs( home and home2 ) looks like the code below. Both having height 100% each. I want to apply some CSS to the second div(home2) using jQuery, only when it is visible to the user in the browser. Please suggest me a way to do so.
<div class="col-md-12 home" id="home">
<div class="col-md-6 col-md-offset-3 menu2">
<h1 class="home2head">Heading 1</h1>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
</div>
</div>
<div class="col-md-12 home2" id="home2">
<div class="col-md-6 menu2" id="menu2">
<h1 class="home2head">Heading 1</h1>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
<p>Some content will go here. Something about the hotel and its specialities.</p>
</div>
</div>
I don't know how to use the $(window).scrollTop() properly, if it is a solution to my problem.