0

On my testsite http://snapsite.byethost22.com (or via http://robinvandernoord.nl) I'm trying to automatically scroll a little bit down after a couple of seconds.

It should scroll to #image in a couple of second, and scroll fluently.

I tried it with meta refresh but it kept refreshing, and it's not smooth.

So my question is: can I do it in another way?

doniyor
  • 31,751
  • 50
  • 146
  • 233
  • Yes, with javascript (as indicated in your tag). Did you try using it? What did you achieve? – Francisco Presencia Aug 08 '14 at 18:18
  • is it really possible to scroll with `meta refresh`? – el Dude Aug 08 '14 at 18:20
  • Well I saw something on the web but I have so many javascript already I don't know if it is going to mix up and act weird and all... –  Aug 08 '14 at 18:21
  • I found out it is not possible to scroll with meta refresh... At least not in my case –  Aug 08 '14 at 18:22
  • 1
    @dude Yes, by specifying a fragment identifier, however it will only jump to the element rather than 'smoothly scrolling'. – Dai Aug 08 '14 at 18:22
  • And I also have many anchors already on my page so I don't know if it is going to work and all... –  Aug 08 '14 at 18:23
  • possible duplicate of [jQuery scroll To Element](http://stackoverflow.com/questions/6677035/jquery-scroll-to-element) – Francisco Presencia Aug 08 '14 at 18:26

2 Answers2

0

Super Easy, use: smooth-scroll.js

How to use: Read Me

Taylor_SM
  • 38
  • 3
0

You could just do it with

setTimeout(
  function() {
    $("html, body").animate({
      scrollTop: $("#image img").offset().top
      });
    },
  2000);

Read this answer for more information: jQuery scroll to element and this: Executing JavaScript after X seconds

Community
  • 1
  • 1
Francisco Presencia
  • 8,240
  • 6
  • 40
  • 83
  • Ctrl + C, go to your page, F12, Ctrl + V in the bottom console line of the "Console" section (in firefox). Takes 10 seconds (; – Francisco Presencia Aug 08 '14 at 18:36
  • I can't do F12 and ctrl: I'm on a mac ;) –  Aug 08 '14 at 20:22
  • Okay it works when I do it offline but when I put it online it doesn't work (at http://snapsite.byethost22.com ) –  Aug 09 '14 at 07:11
  • O it does work at http://van-der-noord.nl/beta so it's probably a problem with the host –  Aug 09 '14 at 07:16