맨 위로 이동 버튼

다크 모드를 지원하는 미니멀하고 반응이 빠른 "Back to Top" 버튼 구성 요소입니다. 아래로 스크롤한 후 표시되며 부드러운 스크롤을 사용하여 클릭할 때 사용자를 페이지 맨 위로 되돌립니다. 스크롤에는 JavaScript가 사용되지 않고 CSS 만 사용됩니다.

미리 보기

HTML 코드

<div class="fixed bottom-4 right-4">
  <a href="#" class="bg-blue-500 text-white p-3 rounded-full shadow-md transition-opacity duration-300 opacity-0 group-hover:opacity-100 dark:bg-blue-700 dark:text-gray-200">
    <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 10l7-7m0 0l7 7m-7-7v18"></path></svg>
  </a>
</div>

<style>
  /* This simple example uses CSS for smooth scrolling. For a production site, you might use a small amount of JavaScript for better compatibility and control over the scroll behavior and when the button appears. */
  html {
    scroll-behavior: smooth;
  }

  /* Basic example to show/hide the button based on scroll position. 
     A robust solution would involve JavaScript Intersection Observer or scroll events. */
  body:before {
    content: "";
    height: 200vh; /* Simulate a long page */
    display: block;
  }

  .group-hover\:opacity-100:hover + .fixed a {
      opacity: 1; /* This part is flawed for demonstrating scroll-based visibility without JS */
  }

  /* A better approach for scroll-based visibility would require JavaScript */
  .fixed a {
      /* Initially hidden, JS would make it visible on scroll */
      opacity: 0;
      transition: opacity 0.3s ease-in-out;
  }


</style>

관련 구성 요소

맨 위로 이동 버튼

사용자가 페이지를 아래로 스크롤할 때 표시되는 Material Design Back to Top 버튼입니다. 다크 모드 지원과 부드러운 스크롤이 포함됩니다.

열다

맨 위로 이동 버튼 구성 요소

전자 상거래를 위해 설계된 반응형 'Back to Top' 버튼 구성 요소로, 어두운 배경에 생생한 색 구성표가 특징입니다. 여기에는 미묘한 호버 효과가 포함되어 있으며 다크 모드 지원을 통해 모든 화면 크기에서 가시성을 보장합니다.

열다

스큐어모픽 맨 위로 돌아가기 버튼

포럼/커뮤니티 플랫폼을 위한 간단하고 반응이 빠르며 스큐어모픽한 'Back to Top' 버튼 구성 요소로, 포레스트/그린 색상 팔레트와 완전한 다크 모드 지원으로 설계되었습니다.

열다