国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

scrollIntoView()? ????? ??? ???? ????? ?? ?????.
P粉690200856
P粉690200856 2024-03-26 20:25:28
0
1
608

??? ??? ????? ?? ??? ????? ???? ?? ?? ??? ???? ??? "?? CSS" ??? ???? ???? ???. ?? ?? ??? ???? ?? ??? ??? ???? ?? ??? scrollIntoView()? ???? ????. ??? ? ??? ?? ?? ??? ??? ???? ??????. ?? ??? ????? ????? ?? ??? ???? ????? ??? ????? ????? ????. ?? Adam Argyle? ?? ?? ???? ?? ??? ?? ????? ?? ??? ??? ?????. ?? ???? ??? ??? ??????.

??? ?? ???? ??????.

https://codepen.io/krjo-the-decoder/pen/dyjPrLy

??? ?? ??? ???? ??? ????? ???? ????? ??? ?? ????? ??????.

????? y? ???? ?? ??? ???? ?? scrollIntoView() ??? scrollTo()? ??? ???? ??? ??? ?????.

<!-- Using tailwind.css -->
<div class="py-48 bg-gray-200">
  <h1 class="text-center font-bold mb-5 text-2xl">Scroll-snap Carousel</h1>
  <div class="grid grid-flow-col overflow-x-auto snap-x snap-mandatory overscroll-x-contain auto-cols-[100%] mx-auto w-[500px]">
    <img src="https://via.placeholder.com/500" width="500" height="500" class="block snap-center w-auto h-auto" data-slide>
    <img src="https://via.placeholder.com/500" width="500" height="500" class="block snap-center w-auto h-auto" data-slide>
    <img src="https://via.placeholder.com/500" width="500" height="500" class="block snap-center w-auto h-auto" data-slide>
    <img src="https://via.placeholder.com/500" width="500" height="500" class="block snap-center w-auto h-auto" data-slide>
  </div>
  <nav class="flex justify-center mt-4">
    <button class="p-2 border rounded-full border-solid border-black w-12 h-12 mx-2" type="button" data-index="0">1</button>
    <button class="p-2 border rounded-full border-solid border-black w-12 h-12 mx-2" type="button" data-index="1">2</button>
    <button class="p-2 border rounded-full border-solid border-black w-12 h-12 mx-2" type="button" data-index="2">3</button>
    <button class="p-2 border rounded-full border-solid border-black w-12 h-12 mx-2" type="button" data-index="3">4</button>
  </nav>
</div>

<script>
const slides = document.querySelectorAll('[data-slide]');
document.querySelectorAll('button').forEach(button => {
  button.addEventListener('click', event => {
    console.log('event',event);
    slides[event.target.dataset.index].scrollIntoView({
      behavior: 'smooth',
      inline:   'center',
    });
  });
});
</script>

P粉690200856
P粉690200856

?? ??(1)
P粉976737101

??? ?? scrollIntoView ??? block: 'nearest'? ??? ???.

????