단일 페이지 (스크롤링) html이 있습니다. 내 div (집 및 집 2)는 아래 코드와 같습니다. 둘 다 높이가 각각 100 %입니다. jQuery를 사용하여 두 번째 div (home2)에 일부 CSS를 적용하려면 브라우저에서 사용자에게 표시되어야합니다. 그렇게 할 수있는 방법을 제안 해주세요. 내 문제에 대한 해결책 경우화면에 나타나는 경우에만 jQuery를 사용하여 div에 CSS를 적용하십시오.
<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>
내가 제대로()는 $ (창)을 사용하는 방법을 .scrollTop을 모른다.
나는 사용자가 화면 위의 것을 통과 한 후에 div를 보여주기 위해 비슷한 질문에 답했다. 당신을 위해 일을하기 위해 적용될 수 있습니다 - http://stackoverflow.com/questions/25660289/show-hide-div-when-passed-the-other-div/25661103#25661103 – Tasos
이 작은 플러그인을 확인할 수 있습니다 : https://github.com/zeusdeux/isInViewport – Rvervuurt
_ "브라우저에서 볼 때"_ 및 _ "포커스가있을 때 _"_은 매우 다른 두 가지입니다. 초점은 일반적으로 선택이나 활성화와 같은 동작을 의미합니다. 그러나 이는 가시성에 대해서는 사실이 아닙니다. CSS를 사용하려고하는 두 사람 중 어느 쪽이 혼란 스럽습니까? – War10ck