Вопрос

I have a simple

<a href="#header">Back to Top</a>

and this puts me to the top of the page immediately. But I want it to go to the top of the page slowly with just CSS.

Is this possible? Thanks in Advance.

Edit: Okay, for anyone with the same problem. It did it with this JQuery:

// #btt is ID of the Back to Top Link
    $("#btt").click(function () {
    //html and body is used because of Browser compatibilit
    $("html, body").animate({scrollTop: 0}, 1000);
    });
Это было полезно?

Решение

You can't activate actions like scrolling with pure CSS, sorry. You'll need some jQuery in there.

What you CAN do is trick the user in thinking the page has scrolled by moving elements around with CSS on :hover, but that's a really bad practice, and would require much more coding that a simple jQuery function.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top