+ 5
♬Astro-GingyFlakeđŸ‡čđŸ‡· you have to give your button the id="bottom" <button id="bottom" class="secret" onclick="secret()">Click me...</button> so that clicking the link will make the page scroll to the button. also, to remove the underline for a, you can use a{ text-decoration:none; } in your css you can also add scrollTo to your javascript secret function so that the page scrolls back to the top when the button is clicked. function secret(){ .... your code ... window.scrollTo(0,0); }
6th Nov 2024, 12:27 AM
Bob_Li
Bob_Li - avatar
+ 3
♬Astro-GingyFlakeđŸ‡čđŸ‡· Your code still have errors. The id bottom have to be assigned to the button, not the link. Here is the fixed version of your code. I also renamed the class 'body' to 'box', because '.body' is easy to confuse with tagName 'body'. https://sololearn.com/compiler-playground/Wuq93vNK6fe8/?ref=app
6th Nov 2024, 3:52 AM
Bob_Li
Bob_Li - avatar
+ 2
♬Astro-GingyFlakeđŸ‡čđŸ‡· here is a pure js scrollIntoView example without using a and href. https://sololearn.com/compiler-playground/WdlSolkk3Po8/?ref=app
6th Nov 2024, 3:26 AM
Bob_Li
Bob_Li - avatar