Forums

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

Home Forums JavaScript ScrollTo like Google Images/Netflix

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238648
    Hailo Coyier
    Participant

    I’m trying to make something in the style of Google Images/Netflix.
    I found some code and merged It with Ken Wheeler’s Slick. I’m not very experienced I would very much appreciate some help. I was told to use something like scrollTo element but I’m still lost.

    http://codepen.io/anon/pen/QNjwdv

    Here’s the effect I want: http://i.imgur.com/7ztK7Cs.gif
    If you go to Google Images and pick an image you will notice it scrolls into view.

    #238767
    Mottie
    Member

    Hi @HailoCoyier!

    If don’t want a smooth animation (just jump), then use scrollTo, but it looks like you want an animation.

    I added the following inside the $('.thumb').click... code (demo):

    var top = $(this).offset().top - 10; 
     // window.scrollTo(0, top); // no animation
     $('html, body').animate({ scrollTop: top }, 1000);
    
    #239051
    Hailo Coyier
    Participant

    Sorry for the late reply. But yes that’s exactly what I was looking for! Thank you so much, Mottie.

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