0

i have structure html, example like this : enter image description here

i am using this code :

<section id="home" >
    <div id="first">
        <div class="top-img">
          <img src="img/home-top.jpg" class="img-responsive" alt="Responsive image">
        </div>
        <div class="bottom-img">
          <img src="img/home-down.jpg" class="img-responsive" alt="Responsive image">
        </div>
    </div>
 </section>

the problem is, i want to scrolling only until the half of the second picture. because, next i want to when user click the second image and second image be scrolltop offset. i do not know how to work it..

Afrgun
  • 313
  • 3
  • 16
  • You have to use scrolltop in jquery. https://api.jquery.com/scrollTop/ – ketan May 25 '15 at 06:35
  • a big problem is, how to make a scrolling only until the half of the second image. scrolltop only my reason why i create it.. :) – Afrgun May 25 '15 at 06:37
  • count the first image height and secong image height. First image height + (second image height / 2) = scrolltop. – ketan May 25 '15 at 06:40

1 Answers1

0

Jquery provide a scroll handler and with this post you will be able to stop the scroll.

1) handle the scroll 2) when the user is near your anchor stop the scroll

Community
  • 1
  • 1
Antoine Pointeau
  • 399
  • 2
  • 14