实现一个动态可过滤的走马灯。

huangapple go评论105阅读模式
英文:

Implementing a Dynamic Filterable Carousel

问题

细节:

我目前正在使用Bootstrap构建一个走马灯,但在使其正确显示方面遇到了一些挑战。以下是我试图实现的概述:

  • 走马灯最初是空的。
  • 点击按钮(将充当过滤器的作用)后,我想用包含图像的div来填充走马灯。当点击按钮(例如,“汽车”)时,只应将汽车的图像添加到走马灯中。单击标有“全部”的按钮应将所有可用图像添加到走马灯中。

要求:

  • 在走马灯中同时显示四个瓦片。
  • 我希望动态走马灯的响应方式与普通走马灯类似,循环显示所有实体。例如,1、2、3、4、5、1、2、3...等。
  • 根据点击的按钮向走马灯添加元素。

我尝试过的:

我有一个正常运行的走马灯,你可以在这里找到:jsfiddle 链接
HTML:

<!-- 走马灯 -->
<div class="desktop-carousel">
  <div class="container text-center">
    <div class="row mx-auto my-auto">
      <div id="myCarousel" class="carousel slide w-100" data-ride="carousel">
        <div class="carousel-inner w-100" role="listbox">
          <div class="carousel-item active">
            <div class="col-lg-3 col-md-5">
              <a href="#">
                <img class="img-fluid" src="http://via.placeholder.com/272x192?text=1" loading="lazy" onerror="imgError()">
              </a>
            </div>
          </div>
          <!-- 其他轮播项... -->
        </div>
        <!-- 控制按钮... -->
      </div>
    </div>
  </div>
</div>

JavaScript:

// 走马灯 //

$('#myCarousel').carousel({
  interval: 2500
});

$('.carousel .carousel-item').each(function() {
  var minPerSlide = 4;
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));

  for (var i = 0; i < minPerSlide; i++) {
    next = next.next();
    if (!next.length) {
      next = $(this).siblings(':first');
    }

    next.children(':first-child').clone().appendTo($(this));
  }
});

然而,我在使动态走马灯按预期工作方面遇到了困难。
这里是链接:jsfiddle 链接
HTML:

<button id="addItemButton" onclick="filterSelection()">向走马灯添加项目</button>

<button id="clearCarousel" onclick="clearCarousel()">从走马灯中清除项目</button>

<div class="container text-center">
  <div class="row mx-auto my-auto">
    <div id="myCarousel" class="carousel slide w-100" data-ride="carousel">
      <div class="carousel-inner w-100" role="listbox"></div>
      <a class="carousel-control-prev" href="#myCarousel" role="button" data-slide="prev">
        上一个
      </a>
      <a class="carousel-control-next" href="#myCarousel" role="button" data-slide="next">
        下一个
      </a>
    </div>
  </div>
</div>

JavaScript:

// 创建走马灯 //
function filterSelection() {
  var carouselData = [
    {
      imageUrl: "http://via.placeholder.com/272x192?text=1",
      name: "Hannon"
    },
    // 其他项目...
  ];

  var carouselInner = $('.carousel-inner');
  var count = 0;
  // 向走马灯添加项目
  carouselData.forEach(function(item, index) {
    if (count == 0) {
      console.log('Inside If');
      var isActive = (index === 0) ? "active" : "";
      var itemHtml = `
      <div class="carousel-item ${isActive}">
        <div class="carousel-item-content col-lg-3 col-md-5">
          <a href="#">
            <img class="img-fluid" src="${item.imageUrl}" alt="${item.name}">
          </a>
        </div>
      </div>
      `;
      carouselInner.append(itemHtml);
    } else {
      console.log('In Else')
      var isActive = (index === 0) ? "active" : "";
      var itemHtml = `
      <div class="carousel-item">
        <div class="carousel-item-content col-lg-3 col-md-5">
          <a href="#">
            <img class="img-fluid" src="${item.imageUrl}" alt="${item.name}">
          </a>
        </div>
      </div>
      `;
      carouselInner.append(itemHtml);
    }
    count++;
  });

  // 初始化走马灯
  $('#myCarousel').carousel();
}


// 运行走马灯 //
$('#myCarousel').carousel({
  interval: 1500
});

$('.carousel .carousel-item').each(function() {
  var minPerSlide = 4;
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));

  for (var i = 0; i < minPerSlide; i++) {
    next = next.next();
    if (!next.length) {
      next = $(this).siblings(':first');
    }

    next.children(':first-child').clone().appendTo($(this));
  }
});

function clearCarousel() {
  $('.carousel-inner').empty();
  $('#myCarousel').carousel('dispose');
}

我将不胜感激地接受您提供的任何建议、替代方法、解决方案或指导。

英文:

Details:

I'm currently working on building a carousel with bootstrap, and I'm facing some challenges in making it display correctly. Here's an overview of what I'm trying to achieve:

  • Initially, the carousel is empty.
  • Upon clicking a button (which would act like a filter), I want to populate the carousel with divs that contain images. When a button is clicked (e.g., "cars"), only images of cars should be added to the carousel. Clicking a button labeled "all" should add all available images to the carousel.

Requirements:

  • Display four tiles at a time in the carousel.
  • I want the dynamic carousel to respond similarly to the normal carousel, rotating through all entities. For example, 1, 2, 3, 4, 5, 1, 2, 3... etc.
  • Add elements to the carousel based on the button clicked.

What i have tried:

I have a functioning normal carousel that you can find here: jsfiddle link
HTML:

&lt;!--Carousel--&gt;
&lt;div class=&quot;desktop-carousel&quot;&gt;
  &lt;div class=&quot;container text-center&quot;&gt;
    &lt;div class=&quot;row mx-auto my-auto&quot;&gt;
      &lt;div id=&quot;myCarousel&quot; class=&quot;carousel slide w-100&quot; data-ride=&quot;carousel&quot;&gt;
        &lt;div class=&quot;carousel-inner w-100&quot; role=&quot;listbox&quot;&gt;
          &lt;div class=&quot;carousel-item active&quot;&gt;
            &lt;div class=&quot;col-lg-3 col-md-5&quot;&gt;
              &lt;a href=&quot;#&quot;&gt;
                &lt;img class=&quot;img-fluid&quot; src=&quot;http://via.placeholder.com/272x192?text=1&quot; loading=&quot;lazy&quot; onerror=&quot;imgError()&quot;&gt;
              &lt;/a&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;carousel-item&quot;&gt;
            &lt;div class=&quot;col-lg-3 col-md-5&quot;&gt;
              &lt;a href=&quot;#&quot;&gt;
                &lt;img class=&quot;img-fluid&quot; src=&quot;http://via.placeholder.com/272x192?text=2&quot; loading=&quot;lazy&quot;&gt;
                &lt;p class=&quot;name items&quot;&gt;Self care&lt;/p&gt;
              &lt;/a&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;carousel-item&quot;&gt;
            &lt;div class=&quot;col-lg-3 col-md-5&quot;&gt;
              &lt;a href=&quot;#&quot;&gt;
                &lt;img class=&quot;img-fluid&quot; src=&quot;http://via.placeholder.com/272x192?text=3&quot; loading=&quot;lazy&quot;&gt;
                &lt;p class=&quot;name items&quot;&gt;Pain&lt;/p&gt;
              &lt;/a&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;carousel-item&quot;&gt;
            &lt;div class=&quot;col-lg-3 col-md-5&quot;&gt;
              &lt;a href=&quot;#&quot;&gt;
                &lt;img class=&quot;img-fluid&quot; src=&quot;http://via.placeholder.com/272x192?text=4&quot; loading=&quot;lazy&quot;&gt;
                &lt;p class=&quot;name items&quot;&gt;Self care&lt;/p&gt;
              &lt;/a&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;carousel-item&quot;&gt;
            &lt;div class=&quot;col-lg-3 col-md-5&quot;&gt;
              &lt;a href=&quot;#&quot;&gt;
                &lt;img class=&quot;img-fluid&quot; src=&quot;http://via.placeholder.com/272x192?text=5&quot; loading=&quot;lazy&quot;&gt;
                &lt;p class=&quot;name items&quot;&gt;Hepilor&lt;/p&gt;
              &lt;/a&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;a class=&quot;carousel-control-prev bg-dark w-auto&quot; href=&quot;#myCarousel&quot; role=&quot;button&quot; data-slide=&quot;prev&quot;&gt;
          &lt;span class=&quot;carousel-control-prev-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;
          &lt;span class=&quot;sr-only&quot;&gt;Previous&lt;/span&gt;
        &lt;/a&gt;
        &lt;a class=&quot;carousel-control-next bg-dark w-auto&quot; href=&quot;#myCarousel&quot; role=&quot;button&quot; data-slide=&quot;next&quot;&gt;
          &lt;span class=&quot;carousel-control-next-icon&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;
          &lt;span class=&quot;sr-only&quot;&gt;Next&lt;/span&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

JavaScript:

// Carousel //

$(&#39;#myCarousel&#39;).carousel({
  interval: 2500
});

$(&#39;.carousel .carousel-item&#39;).each(function() {
  var minPerSlide = 4;
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(&#39;:first&#39;);
  }
  next.children(&#39;:first-child&#39;).clone().appendTo($(this));

  for (var i = 0; i &lt; minPerSlide; i++) {
    next = next.next();
    if (!next.length) {
      next = $(this).siblings(&#39;:first&#39;);
    }

    next.children(&#39;:first-child&#39;).clone().appendTo($(this));
  }
});

However, I'm struggling to make the dynamic carousel work as intended.
Here is a link to it: jsfiddle link
HTML:

&lt;button id=&quot;addItemButton&quot; onclick=&quot;filterSelection()&quot;&gt;Add Items to Carousel&lt;/button&gt;

&lt;button id=&quot;clearCarousel&quot; onclick=&quot;clearCarousel()&quot;&gt;Clear Items From Carousel&lt;/button&gt;

&lt;div class=&quot;container text-center&quot;&gt;
  &lt;div class=&quot;row mx-auto my-auto&quot;&gt;
    &lt;div id=&quot;myCarousel&quot; class=&quot;carousel slide w-100&quot; data-ride=&quot;carousel&quot;&gt;
      &lt;div class=&quot;carousel-inner w-100&quot; role=&quot;listbox&quot;&gt;&lt;/div&gt;
      &lt;a class=&quot;carousel-control-prev&quot; href=&quot;#myCarousel&quot; role=&quot;button&quot; data-slide=&quot;prev&quot;&gt;
        Previous
      &lt;/a&gt;
      &lt;a class=&quot;carousel-control-next&quot; href=&quot;#myCarousel&quot; role=&quot;button&quot; data-slide=&quot;next&quot;&gt;
        Next
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

JavaScript:

// Create Carousel //
function filterSelection() {
  var carouselData = [{
      imageUrl: &quot;http://via.placeholder.com/272x192?text=1&quot;,
      name: &quot;Hannon&quot;
    },
    {
      imageUrl: &quot;http://via.placeholder.com/272x192?text=2&quot;,
      name: &quot;Self care&quot;
    },
    {
      imageUrl: &quot;http://via.placeholder.com/272x192?text=3&quot;,
      name: &quot;Pain&quot;
    },
    {
      imageUrl: &quot;http://via.placeholder.com/272x192?text=4&quot;,
      name: &quot;Self care&quot;
    },
    {
      imageUrl: &quot;http://via.placeholder.com/272x192?text=5&quot;,
      name: &quot;Hepilor&quot;
    }
  ];

  var carouselInner = $(&#39;.carousel-inner&#39;);
  var count = 0;
  // Add items to carousel
  carouselData.forEach(function(item, index) {
    if (count == 0) {
      console.log(&#39;Inside If&#39;);
      var isActive = (index === 0) ? &quot;active&quot; : &quot;&quot;;
      var itemHtml = `
      &lt;div class=&quot;carousel-item ${isActive}&quot;&gt;
        &lt;div class=&quot;carousel-item-content col-lg-3 col-md-5&quot;&gt;
          &lt;a href=&quot;#&quot;&gt;
            &lt;img class=&quot;img-fluid&quot; src=&quot;${item.imageUrl}&quot; alt=&quot;${item.name}&quot;&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      `;
      carouselInner.append(itemHtml);
    } else {
      console.log(&#39;In Else&#39;)
      var isActive = (index === 0) ? &quot;active&quot; : &quot;&quot;;
      var itemHtml = `
      &lt;div class=&quot;carousel-item&quot;&gt;
        &lt;div class=&quot;carousel-item-content col-lg-3 col-md-5&quot;&gt;
          &lt;a href=&quot;#&quot;&gt;
            &lt;img class=&quot;img-fluid&quot; src=&quot;${item.imageUrl}&quot; alt=&quot;${item.name}&quot;&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      `;
      carouselInner.append(itemHtml);
    }
    count++;
  });

  // Initialize the carousel
  $(&#39;#myCarousel&#39;).carousel();
}


// Run carousel //
$(&#39;#myCarousel&#39;).carousel({
  interval: 1500
});

$(&#39;.carousel .carousel-item&#39;).each(function() {
  var minPerSlide = 4;
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(&#39;:first&#39;);
  }
  next.children(&#39;:first-child&#39;).clone().appendTo($(this));

  for (var i = 0; i &lt; minPerSlide; i++) {
    next = next.next();
    if (!next.length) {
      next = $(this).siblings(&#39;:first&#39;);
    }

    next.children(&#39;:first-child&#39;).clone().appendTo($(this));
  }
});

function clearCarousel() {
  $(&#39;.carousel-inner&#39;).empty();
  $(&#39;#myCarousel&#39;).carousel(&#39;dispose&#39;);
}

I would greatly appreciate any suggestions, alternative approaches, solutions, or guidance you can provide.

答案1

得分: 1

这是一个简单的轮播图,一次显示一个项目,可以使用过滤器工作。 这些过滤器易于理解和使用(可以添加更多过滤器和/或修改现有过滤器)。 如果需要,可以扩展它以显示多个元素。

const cars = [
  "https://cdn.motor1.com/images/mgl/3KmYR/s4/genesis-g80-exterior.webp",
  "https://cdn.motor1.com/images/mgl/yM93o/s4/honda-civic-type-r-exterior.webp",
  "https://cdn.motor1.com/images/mgl/KjMYQ/s4/bugatti-divo-exterior.webp"
];

const buildings = [
  "https://ychef.files.bbci.co.uk/1280x720/p0db81jf.jpg",
  "https://ychef.files.bbci.co.uk/1600x900/p0db827c.webp"
];

const dogs = [
  "https://hips.hearstapps.com/hmg-prod/images/dog-puppy-on-garden-royalty-free-image-1586966191.jpg?crop=0.752xw:1.00xh;0.175xw,0&amp;resize=1200:*",
  "https://publish.purewow.net/wp-content/uploads/sites/2/2021/06/smallest-dog-breeds-toy-poodle.jpg?fit=728%2C524",
  "https://www.cdc.gov/healthypets/images/pets/cute-dog-headshot.jpg?_=42445",
  "https://www.thetimes.co.uk/imageserver/image/%2Fmethode%2Ftimes%2Fprod%2Fweb%2Fbin%2Fc47f6830-9292-11ed-b04f-b9bf191ef388.jpg?crop=5879%2C3919%2C0%2C0"
];

const filters = {
  all: [...cars, ...buildings, ...dogs],
  cars,
  buildings,
  dogs
};

const carousel = document.getElementById("carousel");
const carouselNavigation = document.getElementById("carouselNavigation");

function selectFilter(button) {
  button.parentElement.querySelector(".active")?.classList.remove("active");
  const filter = button.getAttribute("value");
  button.classList.add("active");

  carousel.innerHTML = "";
  carouselNavigation.innerHTML = "";

  const thisFilterElementsNumber = filters[filter].length - 1;

  filters[filter].forEach((url, index) => {
    carousel.innerHTML += `
      <div id="carouselSlide${index}" class="carouselSlide">
        <div class="carouselSnapper"></div>
        <a href="#carouselSlide${index === 0 ? thisFilterElementsNumber : (index - 1)}" class="carouselPrev"></a>
        <a href="#carouselSlide${index === thisFilterElementsNumber ? 0 : (index + 1)}" class="carouselNext"></a>
        <img src="${url}">
      </div>
    `;

    carouselNavigation.innerHTML += `<a href="#carouselSlide${index}" class="carouselNavigationButton"></a>`;
  });
}

selectFilter(document.querySelector(`[value="all"]`));
/* CSS部分未翻译,保留原文 */
<div class="filters">
  <p class="filterButton" onclick="selectFilter(this);" value="all">All</p>
  <p class="filterButton" onclick="selectFilter(this);" value="cars">Cars</p>
  <p class="filterButton" onclick="selectFilter(this);" value="buildings">Buildings</p>
  <p class="filterButton" onclick="selectFilter(this);" value="dogs">Dogs</p>
</div>

<div class="carousel">
  <div class="carouselViewport" id="carousel"></div>
  <div class="carouselNavigation" id="carouselNavigation"></div>
</div>
英文:

Here is a simple carousel that shows one item at a time that works with filters. The filters are easy to understand and work with (adding more filters and/or modifying existing ones). You can expand it to show more than one element if needed.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

const cars = [
&quot;https://cdn.motor1.com/images/mgl/3KmYR/s4/genesis-g80-exterior.webp&quot;,
&quot;https://cdn.motor1.com/images/mgl/yM93o/s4/honda-civic-type-r-exterior.webp&quot;,
&quot;https://cdn.motor1.com/images/mgl/KjMYQ/s4/bugatti-divo-exterior.webp&quot;
];
const buildings = [
&quot;https://ychef.files.bbci.co.uk/1280x720/p0db81jf.jpg&quot;,
&quot;https://ychef.files.bbci.co.uk/1600x900/p0db827c.webp&quot;
];
const dogs = [
&quot;https://hips.hearstapps.com/hmg-prod/images/dog-puppy-on-garden-royalty-free-image-1586966191.jpg?crop=0.752xw:1.00xh;0.175xw,0&amp;resize=1200:*&quot;,
&quot;https://publish.purewow.net/wp-content/uploads/sites/2/2021/06/smallest-dog-breeds-toy-poodle.jpg?fit=728%2C524&quot;,
&quot;https://www.cdc.gov/healthypets/images/pets/cute-dog-headshot.jpg?_=42445&quot;,
&quot;https://www.thetimes.co.uk/imageserver/image/%2Fmethode%2Ftimes%2Fprod%2Fweb%2Fbin%2Fc47f6830-9292-11ed-b04f-b9bf191ef388.jpg?crop=5879%2C3919%2C0%2C0&quot;
];
const filters = {
all: [...cars, ...buildings, ...dogs],
cars,
buildings,
dogs
};
const carousel = document.getElementById(&quot;carousel&quot;);
const carouselNavigation = document.getElementById(&quot;carouselNavigation&quot;);
function selectFilter(button) {
button.parentElement.querySelector(&quot;.active&quot;)?.classList.remove(&quot;active&quot;);
const filter = button.getAttribute(&quot;value&quot;);
button.classList.add(&quot;active&quot;);
carousel.innerHTML = &quot;&quot;;
carouselNavigation.innerHTML = &quot;&quot;;
const thisFilterElementsNumber = filters[filter].length - 1;
filters[filter].forEach((url, index) =&gt; {
carousel.innerHTML += `
&lt;div id=&quot;carouselSlide${index}&quot; class=&quot;carouselSlide&quot;&gt;
&lt;div class=&quot;carouselSnapper&quot;&gt;&lt;/div&gt;
&lt;a href=&quot;#carouselSlide${index === 0 ? thisFilterElementsNumber : (index - 1)}&quot; class=&quot;carouselPrev&quot;&gt;&lt;/a&gt;
&lt;a href=&quot;#carouselSlide${index === thisFilterElementsNumber ? 0 : (index + 1)}&quot; class=&quot;carouselNext&quot;&gt;&lt;/a&gt;
&lt;img src=&quot;${url}&quot;&gt;
&lt;/div&gt;
`;
carouselNavigation.innerHTML += `&lt;a href=&quot;#carouselSlide${index}&quot; class=&quot;carouselNavigationButton&quot;&gt;&lt;/a&gt;`;
});
}
selectFilter(document.querySelector(`[value=&quot;all&quot;]`));

<!-- language: lang-css -->

body {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
user-select: none;
}
* {
box-sizing: border-box;
}
*::-webkit-scrollbar {
width: 0px;
height: 0px;
}
/* Filter */
.filters {
position: relative;
width: 400px;
height: auto;
margin: 10px auto;
}
.filterButton {
display: inline-block;
position: relative;
width: fit-content;
height: auto;
color: #ffffff;
background-color: #555555;
border-radius: 999px;
padding: 5px 10px;
cursor: pointer;
}
.filterButton.active {
background-color: #111111;
}
/* Carousel */
.carousel {
position: relative;
width: 400px;
height: 200px;
margin: 10px auto;
perspective: 100px;
}
.carousel::before,
.carousel::after,
.carouselPrev,
.carouselNext {
position: absolute;
top: 50%;
width: 40px;
height: 40px;
font-size: 0;
border-radius: 999px;
transform: translateY(-50%);
}
.carousel::before,
.carouselPrev {
left: 10px;
}
.carousel::after,
.carouselNext {
right: 10px;
}
.carousel::before,
.carousel::after {
content: &quot;&quot;;
font-size: 20px;
text-align: center;
color: #fff;
background-position: center center;
background-size: 20px 20px;
background-repeat: no-repeat;
background-color: #222222;
pointer-events: none;
z-index: 1;
}
.carousel::before {
background-image: url(&quot;data:image/svg+xml,%3Csvg viewBox=&#39;0 0 100 100&#39; xmlns=&#39;http://www.w3.org/2000/svg&#39;%3E%3Cpolygon points=&#39;0,50 80,100 80,0&#39; fill=&#39;%23fff&#39;/%3E%3C/svg%3E&quot;);
}
.carousel::after {
background-image: url(&quot;data:image/svg+xml,%3Csvg viewBox=&#39;0 0 100 100&#39; xmlns=&#39;http://www.w3.org/2000/svg&#39;%3E%3Cpolygon points=&#39;100,50 20,100 20,0&#39; fill=&#39;%23fff&#39;/%3E%3C/svg%3E&quot;);
}
.carouselViewport {
display: flex;
position: absolute;
width: 100%;
height: 100%;
border-radius: 10px;
overflow-x: scroll;
scroll-behavior: smooth;
scroll-snap-type: x mandatory;
}
.carouselSlide {
position: relative;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
flex: 0 0 100%;
}
.carouselSnapper {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
scroll-snap-align: center;
}
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.carouselNavigation {
position: absolute;
width: 100%;
height: auto;
top: 100%;
left: 0px;
text-align: center;
margin-top: 5px;
}
.carouselNavigationButton {
display: inline-block;
width: 14px;
height: 14px;
background-color: #222222;
border-radius: 999px;
transition: transform 0.1s;
margin: 0px 5px;
}

<!-- language: lang-html -->

&lt;div class=&quot;filters&quot;&gt;
&lt;p class=&quot;filterButton&quot; onclick=&quot;selectFilter(this);&quot; value=&quot;all&quot;&gt;All&lt;/p&gt;
&lt;p class=&quot;filterButton&quot; onclick=&quot;selectFilter(this);&quot; value=&quot;cars&quot;&gt;Cars&lt;/p&gt;
&lt;p class=&quot;filterButton&quot; onclick=&quot;selectFilter(this);&quot; value=&quot;buildings&quot;&gt;Buildings&lt;/p&gt;
&lt;p class=&quot;filterButton&quot; onclick=&quot;selectFilter(this);&quot; value=&quot;dogs&quot;&gt;Dogs&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;carousel&quot;&gt;
&lt;div class=&quot;carouselViewport&quot; id=&quot;carousel&quot;&gt;&lt;/div&gt;
&lt;div class=&quot;carouselNavigation&quot; id=&quot;carouselNavigation&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

<!-- end snippet -->

huangapple
  • 本文由 发表于 2023年7月3日 16:38:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76603125.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定