如何用4张图片制作卡产品的幻灯片显示?

发布于 2025-02-11 08:14:39 字数 11199 浏览 2 评论 0原文

我的卡产品具有1个主图片,并在主图下面有3张(小)图片,还带有一些带有按钮的额外文本区域。 我的计划是与这些图片一起幻灯片显示,我需要一些幻灯片节目的导航。 如何用4张图片制作卡产品的幻灯片表演?

*,
*:before,
*:after{
    margin: 0;
    padding: 0;
    border: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;
}
a, p, h1, h2, h3, h4, h5, h6{
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    text-decoration: none;
    color: inherit;
}
html, body{
    background: linear-gradient(to right, #accbee 0%, #e7f0fd 50%);
    height: 100%;
    color: #000;
    background-color: #E5E5E5;
    font-size: 14px;
    font-family: "Maven+Pro", sans-serif;
    line-height: 1;
}
input, textarea{
    outline: none;
}
.container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 1rem;   
}
.header{
    padding: 1.56rem 0;
}
.header__container{
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header__link{
    font-size: 1.5rem;
    font-weight: 700;
    color: #0046FF;
}
.header__button {
    flex: 0 0 16rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.icon-menu {
    position: relative;
    flex: 0 0 1.9rem;
    height: 1.12rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    margin: 0px 0px 0px 20px;
}
.icon-menu::before,
.icon-menu::after {
    content:"";
    height: 2px;
    background-color: #000;
}
.icon-menu span {
    height: 2px;
    background-color: #000;
}
.header__login{
    background-color: #0046FF;
    color: #fff;
    line-height: 1.9rem;
    padding: 0 1.9rem;
    border-radius: 10px;
    text-transform: uppercase;
}
.search__container{
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 18vh;
    margin-bottom: -36px;
}
.search__row{
    display: flex;
    justify-content: space-between;
    margin: 0 0 2.5rem 0;
}
.search__row img:last-child{
    width: 40%;
}

.search__bar{
    margin: 0 0 2.5rem 0;
}
.search__input{
    width: 100%;
    border: 2px solid #80A7E0;
    background: #ffffff;
    border-radius: 0.9rem;
    padding: 0.6rem 0.9rem;
}
.search__cards-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 2.5rem 0;
}
.search__cards-title{
    font-size: 2.1rem;
    font-weight: 700;
}

.search__cards-button{
    background-color: #0046FF;
    color: #fff;
    line-height: 2.5rem;
    height: 2.5rem;
    padding: 0 1.8rem;
    border-radius: 10px;
    text-transform: uppercase;
}


.card__item-img img {
    border-radius: 10px;
    display: block;
    min-width: 800px;
    max-height: 600px;
    object-fit:contain;
    overflow: hidden;
}


footer {
    max-width: 1348px;
    height: 12.5rem;
    background-color: #fff;
    padding: 4.3rem 0;
    border-radius: 15px;    

}

.row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}
.footer__col {
    width: 25%;
    padding: 3rem 1.5rem 0 3.4rem;
}

.footer__links img {
    float:right;
    width:30px;   
    text-align:center;
    
}

.footer__col ul li:not(:last-child) {
    margin-bottom: 1.9rem;
}

.footer__col ul li a {
    font-size: 1rem;
    text-transform: capitalize;
    font-weight: 500;
    display: block;
    color: rgb(128, 127, 128);
    transition: all 0.5s ease;
}

.footer__col ul li a:hover {
    color: #0046FF;
    transform: scale(1.1);
}

.footer__col a img {
    width: 30px;
    height: 30px;
    margin: 0 2rem 0 0;
    transition: all 0.5s ease;
}


.footer__col a img:hover {
    transform: scale(1.5);
    transition: all 0.5s ease;
    
}

.card{
    margin: 0 15px;
    display: flex;
    height: 500px;
    max-width: 1380px;
    margin: 0 auto;
    margin-bottom: 55px;
    justify-content: center;
    align-items: center;
    /* border: solid 1px red; */
    border-radius: 15px;
    overflow: hidden;
}



.card__item-img img{
    background-color: #fff;
    border-radius: 25px;
    object-fit: fill;

    
}

.images {
    display: flex;
    justify-content: space-between;
    align-items: center;
    

}

.img_small_lft {
    max-width: 150px;
    max-height: 150px;
    position: absolute;
    bottom:-60px;
    left:290px;
    border-radius: 15px;
}

.img_small_mid {
    max-width: 150px;
    max-height: 150px;
    position: absolute;
    bottom:-60px;
    left: 450px;
    border-radius: 15px;

}

.img_small_rht {
    max-width: 150px;
    max-height: 150px;
    position: absolute;
    bottom:-60px;
    left: 610px;
    border-radius: 15px;

}
.card__item-container {
    display: flex;
    height: 100%;
    max-width: inherit;
    flex-direction: column;
    align-items: center;
    justify-content:space-evenly;
    /* background-color: #fff; */
    
    
}

.card__item-title {
    font-size: 3rem;
    font-weight: bold;
    font-family:'Maven Pro', serif;
}

.card__item-text{
    margin: 0 20px;
    max-width: 65%;
    font-size: 1.1rem;
    text-align: justify;
    letter-spacing: 2px;
    line-height: 25px;
    
}

.button-64 {
    align-items: center;
    background-image: linear-gradient(144deg,#AF40FF, #5B42F3 50%,#00DDEB);
    border: 0;
    border-radius: 8px;
    box-sizing: border-box;
    color: #FFFFFF;
    display: flex;
    font-family: Phantomsans, sans-serif;
    font-size: 20px;
    font-weight: 700;
    justify-content: center;
    line-height: 1em;
    max-width: 100%;
    min-width: 140px;
    padding: 3px;
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    white-space: nowrap;
    cursor: pointer;
  }
  
  .button-64:active,
  .button-64:hover {
    outline: 0;
  }
  
  .button-64 span {
    background-color: rgb(23, 215, 80);
    padding: 16px 44px;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    transition: 300ms;
  }
  
  .button-64:hover span {
    background: none;
  }
  
  @media (min-width: 768px) {
    .button-64 {
      font-size: 24px;
      min-width: 196px;
    }
  }
<body>
    <!-- Header -->
    <header class="header container">
        <div class="header__container container">
            <a class="header__link" href="#">AIRSHOP</a>
            <div class="header__button">
                <a class="header__login" href="#">Log in</a>
                <a href="#menu" type="button" class="menu__icon icon-menu"><span></span></a>
            </div>
        </div>
    </header>
    <!-- Main -->
    <div class="search container">
        <div class="search__container container">
            <div class="search__bar">
                <input class="search__input" type="text" placeholder="Search..">
            </div>
            <div class="search__cards">
                <div class="search__cards-header">
                    
                </div>
               
                </div>
            </div>
        </div>
    </div>
    

 
           
        </div>
    </div> 

        <div class="card container">

        <div class="card_image-container">

            <div class="card__item-img"><img src="https://images.unsplash.com/photo-1619659085779-29fcc0e41110?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTd8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60g" alt="img"></div>
           
        </div>

        <div class="card__item-container">

            <h2 class="card__item-title">Joystick</h2>

            <p class="card__item-text">A joystick, sometimes called a flight stick, is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. A joystick, also known as the control column, is the principal control device in the cockpit of many civilian and military aircraft, either as a centre stick or side-stick. It often has supplementary switches to control various aspects of the aircraft's flight. </p>

            <button class="button-64" role="button"><span class="text">BUY NOW</span></button>
           
            
            <div class="images">
                <img class="img_small_lft" src="https://images.unsplash.com/photo-1619651565830-892ccdb2bd51?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTl8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60" alt="img" srcset="">
                <img class="img_small_rht" src="https://images.unsplash.com/photo-1586063029643-fd87377743ef?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTh8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60" alt="img" srcset="">
                <img class="img_small_mid" src="https://images.unsplash.com/photo-1597464524506-cb28023a9adf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTN8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60" alt="img" srcset="">            
            </div>
        </div>
    </div>




    <!-- Footer -->
    <footer class="footer container">
        <div class="row">        
            <div class="footer__links footer__col">
                <ul class="footer__links-list">
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                </ul>
            </div> 

            <div class="footer__links footer__col">    
                <ul class="footer__links-list">
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                    <li class="footer__links-items"><a href="#">Contact </a></li>
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                </ul>
            </div>

            <div class="footer__links footer__col">
                <div class="footer__social-links">
                    <a href=""><img src="Pinterest" alt="Pinterest" class="footer__social-link"></a>
                    <a href=""><img src="" alt="Pinterest"class="footer__social-link"></a>
                    <a href=""><img src="" alt="Pinterest" class="footer__social-link"></a> 
                    <a href=""><img src="" alt="Pinterest" class="footer__social-link"></a> 
                              
     
                </div>
            </div>

        </div>    

    </footer>


</body>
</html>

I have card product with 1 main picture and 3 additional (small) pictures beneath the main one and also have some additional text area with a button.
My plan is to have slide show with those pictures and I need some navigation for that slide show.
How to make a slide show for card product with 4 pictures?

*,
*:before,
*:after{
    margin: 0;
    padding: 0;
    border: 0;
    box-sizing: border-box;
    list-style: none;
    text-decoration: none;
}
a, p, h1, h2, h3, h4, h5, h6{
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    text-decoration: none;
    color: inherit;
}
html, body{
    background: linear-gradient(to right, #accbee 0%, #e7f0fd 50%);
    height: 100%;
    color: #000;
    background-color: #E5E5E5;
    font-size: 14px;
    font-family: "Maven+Pro", sans-serif;
    line-height: 1;
}
input, textarea{
    outline: none;
}
.container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 0 1rem;   
}
.header{
    padding: 1.56rem 0;
}
.header__container{
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.header__link{
    font-size: 1.5rem;
    font-weight: 700;
    color: #0046FF;
}
.header__button {
    flex: 0 0 16rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.icon-menu {
    position: relative;
    flex: 0 0 1.9rem;
    height: 1.12rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between; 
    margin: 0px 0px 0px 20px;
}
.icon-menu::before,
.icon-menu::after {
    content:"";
    height: 2px;
    background-color: #000;
}
.icon-menu span {
    height: 2px;
    background-color: #000;
}
.header__login{
    background-color: #0046FF;
    color: #fff;
    line-height: 1.9rem;
    padding: 0 1.9rem;
    border-radius: 10px;
    text-transform: uppercase;
}
.search__container{
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 18vh;
    margin-bottom: -36px;
}
.search__row{
    display: flex;
    justify-content: space-between;
    margin: 0 0 2.5rem 0;
}
.search__row img:last-child{
    width: 40%;
}

.search__bar{
    margin: 0 0 2.5rem 0;
}
.search__input{
    width: 100%;
    border: 2px solid #80A7E0;
    background: #ffffff;
    border-radius: 0.9rem;
    padding: 0.6rem 0.9rem;
}
.search__cards-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 2.5rem 0;
}
.search__cards-title{
    font-size: 2.1rem;
    font-weight: 700;
}

.search__cards-button{
    background-color: #0046FF;
    color: #fff;
    line-height: 2.5rem;
    height: 2.5rem;
    padding: 0 1.8rem;
    border-radius: 10px;
    text-transform: uppercase;
}


.card__item-img img {
    border-radius: 10px;
    display: block;
    min-width: 800px;
    max-height: 600px;
    object-fit:contain;
    overflow: hidden;
}


footer {
    max-width: 1348px;
    height: 12.5rem;
    background-color: #fff;
    padding: 4.3rem 0;
    border-radius: 15px;    

}

.row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}
.footer__col {
    width: 25%;
    padding: 3rem 1.5rem 0 3.4rem;
}

.footer__links img {
    float:right;
    width:30px;   
    text-align:center;
    
}

.footer__col ul li:not(:last-child) {
    margin-bottom: 1.9rem;
}

.footer__col ul li a {
    font-size: 1rem;
    text-transform: capitalize;
    font-weight: 500;
    display: block;
    color: rgb(128, 127, 128);
    transition: all 0.5s ease;
}

.footer__col ul li a:hover {
    color: #0046FF;
    transform: scale(1.1);
}

.footer__col a img {
    width: 30px;
    height: 30px;
    margin: 0 2rem 0 0;
    transition: all 0.5s ease;
}


.footer__col a img:hover {
    transform: scale(1.5);
    transition: all 0.5s ease;
    
}

.card{
    margin: 0 15px;
    display: flex;
    height: 500px;
    max-width: 1380px;
    margin: 0 auto;
    margin-bottom: 55px;
    justify-content: center;
    align-items: center;
    /* border: solid 1px red; */
    border-radius: 15px;
    overflow: hidden;
}



.card__item-img img{
    background-color: #fff;
    border-radius: 25px;
    object-fit: fill;

    
}

.images {
    display: flex;
    justify-content: space-between;
    align-items: center;
    

}

.img_small_lft {
    max-width: 150px;
    max-height: 150px;
    position: absolute;
    bottom:-60px;
    left:290px;
    border-radius: 15px;
}

.img_small_mid {
    max-width: 150px;
    max-height: 150px;
    position: absolute;
    bottom:-60px;
    left: 450px;
    border-radius: 15px;

}

.img_small_rht {
    max-width: 150px;
    max-height: 150px;
    position: absolute;
    bottom:-60px;
    left: 610px;
    border-radius: 15px;

}
.card__item-container {
    display: flex;
    height: 100%;
    max-width: inherit;
    flex-direction: column;
    align-items: center;
    justify-content:space-evenly;
    /* background-color: #fff; */
    
    
}

.card__item-title {
    font-size: 3rem;
    font-weight: bold;
    font-family:'Maven Pro', serif;
}

.card__item-text{
    margin: 0 20px;
    max-width: 65%;
    font-size: 1.1rem;
    text-align: justify;
    letter-spacing: 2px;
    line-height: 25px;
    
}

.button-64 {
    align-items: center;
    background-image: linear-gradient(144deg,#AF40FF, #5B42F3 50%,#00DDEB);
    border: 0;
    border-radius: 8px;
    box-sizing: border-box;
    color: #FFFFFF;
    display: flex;
    font-family: Phantomsans, sans-serif;
    font-size: 20px;
    font-weight: 700;
    justify-content: center;
    line-height: 1em;
    max-width: 100%;
    min-width: 140px;
    padding: 3px;
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    white-space: nowrap;
    cursor: pointer;
  }
  
  .button-64:active,
  .button-64:hover {
    outline: 0;
  }
  
  .button-64 span {
    background-color: rgb(23, 215, 80);
    padding: 16px 44px;
    border-radius: 6px;
    width: 100%;
    height: 100%;
    transition: 300ms;
  }
  
  .button-64:hover span {
    background: none;
  }
  
  @media (min-width: 768px) {
    .button-64 {
      font-size: 24px;
      min-width: 196px;
    }
  }
<body>
    <!-- Header -->
    <header class="header container">
        <div class="header__container container">
            <a class="header__link" href="#">AIRSHOP</a>
            <div class="header__button">
                <a class="header__login" href="#">Log in</a>
                <a href="#menu" type="button" class="menu__icon icon-menu"><span></span></a>
            </div>
        </div>
    </header>
    <!-- Main -->
    <div class="search container">
        <div class="search__container container">
            <div class="search__bar">
                <input class="search__input" type="text" placeholder="Search..">
            </div>
            <div class="search__cards">
                <div class="search__cards-header">
                    
                </div>
               
                </div>
            </div>
        </div>
    </div>
    

 
           
        </div>
    </div> 

        <div class="card container">

        <div class="card_image-container">

            <div class="card__item-img"><img src="https://images.unsplash.com/photo-1619659085779-29fcc0e41110?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTd8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60g" alt="img"></div>
           
        </div>

        <div class="card__item-container">

            <h2 class="card__item-title">Joystick</h2>

            <p class="card__item-text">A joystick, sometimes called a flight stick, is an input device consisting of a stick that pivots on a base and reports its angle or direction to the device it is controlling. A joystick, also known as the control column, is the principal control device in the cockpit of many civilian and military aircraft, either as a centre stick or side-stick. It often has supplementary switches to control various aspects of the aircraft's flight. </p>

            <button class="button-64" role="button"><span class="text">BUY NOW</span></button>
           
            
            <div class="images">
                <img class="img_small_lft" src="https://images.unsplash.com/photo-1619651565830-892ccdb2bd51?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTl8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60" alt="img" srcset="">
                <img class="img_small_rht" src="https://images.unsplash.com/photo-1586063029643-fd87377743ef?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTh8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60" alt="img" srcset="">
                <img class="img_small_mid" src="https://images.unsplash.com/photo-1597464524506-cb28023a9adf?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTN8fGFpcnBsYW5lc3xlbnwwfDB8MHx8&auto=format&fit=crop&w=600&q=60" alt="img" srcset="">            
            </div>
        </div>
    </div>




    <!-- Footer -->
    <footer class="footer container">
        <div class="row">        
            <div class="footer__links footer__col">
                <ul class="footer__links-list">
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                </ul>
            </div> 

            <div class="footer__links footer__col">    
                <ul class="footer__links-list">
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                    <li class="footer__links-items"><a href="#">Contact </a></li>
                    <li class="footer__links-items"><a href="#">Contact</a></li>
                </ul>
            </div>

            <div class="footer__links footer__col">
                <div class="footer__social-links">
                    <a href=""><img src="Pinterest" alt="Pinterest" class="footer__social-link"></a>
                    <a href=""><img src="" alt="Pinterest"class="footer__social-link"></a>
                    <a href=""><img src="" alt="Pinterest" class="footer__social-link"></a> 
                    <a href=""><img src="" alt="Pinterest" class="footer__social-link"></a> 
                              
     
                </div>
            </div>

        </div>    

    </footer>


</body>
</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

野の 2025-02-18 08:14:39

在html/css和一些JS中使用这样的缩略图滑块,但您可以使用swiper js

 

const carouselContainer = document.querySelector('.carousel-container');
const listImageArea = carouselContainer.querySelector('.next-list');
const listOfImages = listImageArea.querySelectorAll('img');
const currentImage = carouselContainer.querySelector('.current-image');
const arrowLeft = carouselContainer.querySelector('.arrow-left');
const arrowRight = carouselContainer.querySelector('.arrow-right');

function styleList() {
    if (listImageArea.scrollWidth == listImageArea.offsetWidth){
        listImageArea.style.justifyContent = 'center'
    } else {
        listImageArea.style.justifyContent = 'flex-start'
    }

};

function goToRight() {
    var current = listImageArea.querySelector('.current-image-list');
    current.parentElement.nextElementSibling.children[0].classList.add('current-image-list');
    current.classList.remove('current-image-list');
    current = listImageArea.querySelector('.current-image-list');
    listImageArea.scrollLeft = current.offsetLeft;
    currentImage.attributes.src.value = current.attributes.src.value;
    currentImage.classList.add('slideInFromRight');
    setTimeout(function () {
        currentImage.classList.remove('slideInFromRight');
    }, 500);
};

function goToLeft() {
    var current = listImageArea.querySelector('.current-image-list');
    current.parentElement.previousElementSibling.children[0].classList.add('current-image-list');
    current.classList.remove('current-image-list');
    current = listImageArea.querySelector('.current-image-list');
    listImageArea.scrollLeft = current.offsetLeft;
    currentImage.attributes.src.value = current.attributes.src.value;
    currentImage.classList.add('slideInFromLeft');
    setTimeout(function () {
        currentImage.classList.remove('slideInFromLeft');
    }, 500);
};

function changeCurrentImage (newImage) {
    currentImage.classList.add('fadeIn');
    setTimeout(function () {
        currentImage.classList.remove('fadeIn');
    }, 500);
    currentImage.attributes.src.value = this.attributes.src.value;
    //listOfImages.forEach(image => image.classList.remove('current-image-list'));
    listOfImages.forEach(function (image) {
        image.classList.remove('current-image-list');
    })
    this.classList.add('current-image-list');
}

styleList();

arrowLeft.addEventListener('click', goToLeft);
arrowRight.addEventListener('click', goToRight);

window.addEventListener('resize', function (e) {
    styleList();
});

(function () {
    if ( typeof NodeList.prototype.forEach === "function" ) return false;
    NodeList.prototype.forEach = Array.prototype.forEach;
})();

//listOfImages.forEach(image => image.addEventListener('click', changeCurrentImage));
listOfImages.forEach(function(image) {
    image.addEventListener('click', changeCurrentImage);
});
html, body {
    padding: 0;
    margin: 0;
}

.project-page-main {
    margin-left: 70px;
}

.carousel-container {
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    position: relative;
    display: flex;
    justify-content: center;
    background-color: #333;
    overflow: hidden;
}

.current-image {
    width: auto;
    height: 100%;
}

.next-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100px;
    position: absolute;
    top: 10px;
    left: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: all .5s;
}

.next-list li {
    display: inline-block;
    padding: 0;
    margin: 0;
    width: 100px;
    min-width: 100px;
    height: 51px;
    margin: 0 5px;
    text-align: center;
    line-height: 50px;
    cursor: pointer;
    transition: all .5s;
}
.next-list li:first-of-type {
    padding-left: 15px;
}
.next-list li:last-of-type {
    padding-right: 15px;
}

.image-of-list {
    width: 100%;
    height: 100%;
    opacity: 0.5;
    box-shadow: 0 0 20px #000;
    transition: all .5s;
}

.current-image-list {
    opacity: 1;
    transition: all .5s;
}

.arrow {
    display: flex;
    position: absolute;
    width: 50px;
    height: 100px;
    top: 10px;
    flex: 1;
    text-align: center;
    line-height: 50px;
    color: #FFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}


.arrow-left {
    left: 10px;
}
.arrow-right {
    right: 10px;
}

 /*
 * Animations
 */

 @keyframes fadeIn {
     0% {opacity: 0}
     100% {opacity: 1}
 }

 @keyframes slideInFromLeft {
     0% {
        opacity: 0;
        transform: translateX(-100%);
        }
     100% {
        opacity: 1;
        transform: translateX(0px);
     }
 }

 @keyframes slideInFromRight {
     0% {
        opacity: 0;
        transform: translateX(100%);
        }
     100% {
        opacity: 1;
        transform: translateX(0px);
     }
 }

 .slideInFromLeft {
    animation: slideInFromLeft .5s ease-in-out;
 }

 .slideInFromRight {
    animation: slideInFromRight .5s ease-in-out;
 }

 .fadeIn {
    animation: fadeIn .5s ease-in-out;
 }
<section class="carousel-container">
        <img src="http://www.planwallpaper.com/static/images/desktop-year-of-the-tiger-images-wallpaper.jpg" alt="" class="current-image">
        <span class="arrow arrow-left"> Prev </span>
        <ul class="next-list">
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list current-image-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
        </ul>
        <span class="arrow arrow-right"> Next </span>
    </section>

您可以使用 swiper slider,使用 thumbs画廊环路并将缩略图移动到CSS中。

slider with thumbnail like this in HTML/CSS and some Js but you can use swiper js

 

const carouselContainer = document.querySelector('.carousel-container');
const listImageArea = carouselContainer.querySelector('.next-list');
const listOfImages = listImageArea.querySelectorAll('img');
const currentImage = carouselContainer.querySelector('.current-image');
const arrowLeft = carouselContainer.querySelector('.arrow-left');
const arrowRight = carouselContainer.querySelector('.arrow-right');

function styleList() {
    if (listImageArea.scrollWidth == listImageArea.offsetWidth){
        listImageArea.style.justifyContent = 'center'
    } else {
        listImageArea.style.justifyContent = 'flex-start'
    }

};

function goToRight() {
    var current = listImageArea.querySelector('.current-image-list');
    current.parentElement.nextElementSibling.children[0].classList.add('current-image-list');
    current.classList.remove('current-image-list');
    current = listImageArea.querySelector('.current-image-list');
    listImageArea.scrollLeft = current.offsetLeft;
    currentImage.attributes.src.value = current.attributes.src.value;
    currentImage.classList.add('slideInFromRight');
    setTimeout(function () {
        currentImage.classList.remove('slideInFromRight');
    }, 500);
};

function goToLeft() {
    var current = listImageArea.querySelector('.current-image-list');
    current.parentElement.previousElementSibling.children[0].classList.add('current-image-list');
    current.classList.remove('current-image-list');
    current = listImageArea.querySelector('.current-image-list');
    listImageArea.scrollLeft = current.offsetLeft;
    currentImage.attributes.src.value = current.attributes.src.value;
    currentImage.classList.add('slideInFromLeft');
    setTimeout(function () {
        currentImage.classList.remove('slideInFromLeft');
    }, 500);
};

function changeCurrentImage (newImage) {
    currentImage.classList.add('fadeIn');
    setTimeout(function () {
        currentImage.classList.remove('fadeIn');
    }, 500);
    currentImage.attributes.src.value = this.attributes.src.value;
    //listOfImages.forEach(image => image.classList.remove('current-image-list'));
    listOfImages.forEach(function (image) {
        image.classList.remove('current-image-list');
    })
    this.classList.add('current-image-list');
}

styleList();

arrowLeft.addEventListener('click', goToLeft);
arrowRight.addEventListener('click', goToRight);

window.addEventListener('resize', function (e) {
    styleList();
});

(function () {
    if ( typeof NodeList.prototype.forEach === "function" ) return false;
    NodeList.prototype.forEach = Array.prototype.forEach;
})();

//listOfImages.forEach(image => image.addEventListener('click', changeCurrentImage));
listOfImages.forEach(function(image) {
    image.addEventListener('click', changeCurrentImage);
});
html, body {
    padding: 0;
    margin: 0;
}

.project-page-main {
    margin-left: 70px;
}

.carousel-container {
    width: 100%;
    height: 100vh;
    margin: 0 auto;
    position: relative;
    display: flex;
    justify-content: center;
    background-color: #333;
    overflow: hidden;
}

.current-image {
    width: auto;
    height: 100%;
}

.next-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100px;
    position: absolute;
    top: 10px;
    left: 0;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: all .5s;
}

.next-list li {
    display: inline-block;
    padding: 0;
    margin: 0;
    width: 100px;
    min-width: 100px;
    height: 51px;
    margin: 0 5px;
    text-align: center;
    line-height: 50px;
    cursor: pointer;
    transition: all .5s;
}
.next-list li:first-of-type {
    padding-left: 15px;
}
.next-list li:last-of-type {
    padding-right: 15px;
}

.image-of-list {
    width: 100%;
    height: 100%;
    opacity: 0.5;
    box-shadow: 0 0 20px #000;
    transition: all .5s;
}

.current-image-list {
    opacity: 1;
    transition: all .5s;
}

.arrow {
    display: flex;
    position: absolute;
    width: 50px;
    height: 100px;
    top: 10px;
    flex: 1;
    text-align: center;
    line-height: 50px;
    color: #FFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}


.arrow-left {
    left: 10px;
}
.arrow-right {
    right: 10px;
}

 /*
 * Animations
 */

 @keyframes fadeIn {
     0% {opacity: 0}
     100% {opacity: 1}
 }

 @keyframes slideInFromLeft {
     0% {
        opacity: 0;
        transform: translateX(-100%);
        }
     100% {
        opacity: 1;
        transform: translateX(0px);
     }
 }

 @keyframes slideInFromRight {
     0% {
        opacity: 0;
        transform: translateX(100%);
        }
     100% {
        opacity: 1;
        transform: translateX(0px);
     }
 }

 .slideInFromLeft {
    animation: slideInFromLeft .5s ease-in-out;
 }

 .slideInFromRight {
    animation: slideInFromRight .5s ease-in-out;
 }

 .fadeIn {
    animation: fadeIn .5s ease-in-out;
 }
<section class="carousel-container">
        <img src="http://www.planwallpaper.com/static/images/desktop-year-of-the-tiger-images-wallpaper.jpg" alt="" class="current-image">
        <span class="arrow arrow-left"> Prev </span>
        <ul class="next-list">
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list current-image-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
            <li><img src="https://picsum.photos/500/500/?random" alt="" class="image-of-list"></li>
        </ul>
        <span class="arrow arrow-right"> Next </span>
    </section>

you can use Swiper slider , use Thumbs gallery loop and move thumbnail image up in css .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文