Scroll Down Button und Back to Top?

Hallo,

ich möchte für eine Website, welche ich für die Schule machen soll, einen Scroll Down Button programmieren, welcher mich beim drauf drücken nach untem zum Inhalt scrollt (Startpunkt ist der Seitenanfang, in meinem Fall ein Bild. Der Inhalt kommt erst nach dem Bild)

Außerdem möchte ich dann auch einen Back to Top Button, welcher mich dann wieder an den Seitenanfang bringt.

Der Scroll Down Button sollte 3 Pfeile sein, welche von oben nach unten blinken. Und der Back to Top Button sollte ein einfacher Kreis

unten rechts sein, mit einem Pfeil nach oben und die Box sollte die Farbe ändern, wenn man mit dem Cursor drauf ist.

Ich habe mal Beispielbidler angefügt

Dafür soll ich JavaScript benutzen.
Leider finde ich nichts passendes im Internet und frage deshalb hier um Hilfe.

Grüße Alex

(1 votes)
Loading...

Similar Posts

Subscribe
Notify of
4 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
regex9
1 year ago

(…) program a scroll down button that scrolls me to content when pressing on it (…) In addition, I would also like a back to top button (…)

Give the button an event lister to the click here-Event listens. When the event is triggered, you can use the scrollTo– Scroll function up or down.

const scrollingElement = (document.scrollingElement || document.body);

// scroll to bottom:
window.scrollTo({ top: scrollingElement.scrollHeight, behavior: 'smooth' });

// scroll to top:
window.scrollTo({ top: 0, behavior: 'smooth' });

The scroll down button should be 3 arrows flashing from top to bottom.

In principle, I would always dispense with flashing effects because they interfere with the page visitor when reading the page content.

Nevertheless: For implementation, I would use Inline-SVG (each arrow corresponds to a separate SVG-Path; use SVG online editors or search for finished SVG-Icons). You can then animate all three SVG elements with CSS. You should achieve the appropriate effect by changing the arrow color (example: arrow 1 after 1s, arrow 2 after 2s, arrow 3 after 3s).

And the Back to Top Button (…)

You can also work with SVG. The positioning and hover effects are successful with CSS.

Example:

.back-to-top {
  bottom: 20px;
  position: fixed;
  right: 20px;
}

.back-to-top:hover {
  fill: red;
}

Unfortunately I find nothing suitable on the Internet (…)

CSS, SVG and JavaScript references can be found here:

IchMalWiederXY
1 year ago

To jump to a certain place there is the principle of a “anchor”.
A piece of scrolling doesn’t get you to the right place reliably.

Here
HTML/Tutorials/Links/Page-Internal References – SELFHTML-Wiki
an example (also for playing)