HTML CSS And JQuery 实现滑动显示框cid1034-代码设计

index.html

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" charset="utf-8"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/owl.carousel.min.js" charset="utf-8"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css">
    <link rel="stylesheet" href="style.css">
  </head>
  <body>
    <div class="blogs owl-carousel">
      <div class="blog">
        <img src="1.jpg" alt="">
        <div class="blog-description">
          <div class="categorie">Food</div>
          <h2 class="title">Lorem ipsum dolor sit amet</h2>
          <div class="date">Jan 13 2020</div>
          <a href="#" class="btn">Read More</a>
        </div>
      </div>

      <div class="blog">
        <img src="2.jpg" alt="">
        <div class="blog-description">
          <div class="categorie">Cars</div>
          <h2 class="title">Lorem ipsum dolor sit amet</h2>
          <div class="date">Jan 13 2020</div>
          <a href="#" class="btn">Read More</a>
        </div>
      </div>

      <div class="blog">
        <img src="3.jpg" alt="">
        <div class="blog-description">
          <div class="categorie">Coding</div>
          <h2 class="title">Lorem ipsum dolor sit amet</h2>
          <div class="date">Jan 13 2020</div>
          <a href="#" class="btn">Read More</a>
        </div>
      </div>

      <div class="blog">
        <img src="4.jpg" alt="">
        <div class="blog-description">
          <div class="categorie">Sports</div>
          <h2 class="title">Lorem ipsum dolor sit amet</h2>
          <div class="date">Jan 13 2020</div>
          <a href="#" class="btn">Read More</a>
        </div>
      </div>
    </div>

    <script type="text/javascript">
      $(".owl-carousel").owlCarousel({
        items: 2,
        margin: 20,
        loop: true,
        center: true,
        dots: false
      });
    </script>
  </body>
</html>

 

style.css

*{
  margin: 0;
  padding: 0;
  font-family: "Open Sans",sans-serif;
}

.blogs{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

.blog{
  overflow: hidden;
  position: relative;
  height: 100%;
  cursor: pointer;
}

.blog img{
  width: 100%;
  height: 100%;
}

.blog-description{
  position: absolute;
  bottom: -40px;
  background: #333333ca;
  width: 100%;
  padding: 40px;
  transition: .3s linear;
}

.blog:hover .blog-description{
  bottom: 0;
}

.categorie{
  display: inline-block;
  color: #e77f67;
  font-size: 18px;
  position: relative;
  padding: 0 22px;
}

.categorie::before{
  content: '';
  position: absolute;
  width: 14px;
  height: 2px;
  background: #e77f67;
  left: 0;
  top: 13px;
}

.categorie::after{
  content: '';
  position: absolute;
  width: 14px;
  height: 2px;
  background: #e77f67;
  right: 0;
  top: 13px;
}

.title{
  color: #fff;
  font-weight: 500;
  margin: 5px 0;
}

.date{
  font-style: italic;
  color: #e77f67;
  margin-bottom: 20px;
}

.btn{
  display: inline-block;
  color: #e77f67;
  text-decoration: none;
  border: 1px solid #e77f67;
  padding: 6px 20px;
  opacity: 0;
  transition: .3s linear;
}

.blog:hover .btn{
  opacity: 1;
}

.btn:hover{
  color: #fff;
  background: #e77f67;
}

.owl-stage{
  display: flex !important;
}

让链接同时具备两种打开方式

获取源码: Sliding Blogs
下载数:156人次, 文件大小: 0, 上传日期: 2020年-11月-26日

公众号回复:gcode  获取解压密码

qrcode_for_gh_6ea2c28a1709_258 (1)

1,979 人查阅

获取资源构建和完善自己的源码库
源码可以在本地直接演示
同时研究和体验 如何将一些具体的想法的实现过程
源码可以直接嫁接到自己的网站里复用
稍作修改成为自己的作品
下载 (4)

您需要先支付 6元 才能查看此处内容!立即支付