Подробное описание и демонстрация работы блока «Новостной слайдер» для сайта под номером №18 для библиотеки Bootstrap. Html и CSS код для новостного слайдера на сайте как на изображении.

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div id="news-slider" class="owl-carousel">
                <div class="post-slide">
                    <img src="images/img-1.jpg" alt="">
                    <div class="post-date">
                        <span class="month">Nov</span>
                        <span class="date">5</span>
                    </div>
                    <h3 class="post-title">
                        <a href="#">Lorem ipsum dolor sit amet, consectetur.</a>
                    </h3>
                    <p class="post-description">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam consectetur cumque dolorum, ex incidunt ipsa laudantium necessitatibus neque quae tempora......
                    </p>
                    <a href="#" class="read-more">read more<i class="fa fa-chevron-right"></i></a>
                </div>
 
                <div class="post-slide">
                    <img src="images/img-2.jpg" alt="">
                    <div class="post-date">
                        <span class="month">Nov</span>
                        <span class="date">8</span>
                    </div>
                    <h3 class="post-title">
                        <a href="#">Lorem ipsum dolor sit amet, consectetur.</a>
                    </h3>
                    <p class="post-description">
                        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam consectetur cumque dolorum, ex incidunt ipsa laudantium necessitatibus neque quae tempora......
                    </p>
                    <a href="#" class="read-more">read more<i class="fa fa-chevron-right"></i></a>
                </div>
            </div>
        </div>
    </div>
</div>
html разметка и css стили для реализации блока «Новостной слайдер»
$(document).ready(function() {
    $("#news-slider").owlCarousel({
        items : 4,
        itemsDesktop:[1199,3],
        itemsDesktopSmall:[980,2],
        itemsMobile : [600,1],
        navigation:true,
        navigationText:["",""],
        pagination:true,
        autoPlay:true
    });
});
.post-slide{
    padding-bottom: 10px;
    margin: 0 15px;
    position:relative;
}
.post-slide img{
    width: 100%;
    height: auto;
}
.post-slide .post-date{
    position:absolute;
    top:2%;
    left:8%;
    padding: 3% 5%;
    background: #e74c3c;
}
.post-slide .month{
    font-size: 14px;
    color:#fff;
    font-weight: bold;
    text-transform:uppercase;
}
.post-slide .month:after{
    content:"";
    display: block;
    border:1px solid #fff;
}
.post-slide .date{
    font-size: 14px;
    color:#fff;
    display: block;
    text-align:center;
    font-weight: bold;
}
.post-slide .post-title{
    margin:25px 0 15px 0;
}
.post-slide .post-title a{
    font-size:15px;
    font-weight:bold;
    color:#333;
    display: inline-block;
    text-transform:uppercase;
    transition: all 0.3s ease 0s;
}
.post-slide .post-title a:hover{
    text-decoration: none;
    color:#e74c3c;
}
.post-slide .post-description{
    font-size: 14px;
    line-height:24px;
    color:#808080;
}
.post-slide .read-more{
    color:#333;
    text-transform:capitalize;
    transition: color 0.20s linear;
}
.post-slide .read-more i{
    margin-left:10px;
    font-size:10px;
}
.post-slide .read-more:hover{
    text-decoration:none;
    color:#e74c3c;
}
.owl-controls .owl-buttons{
    margin-top:20px;
    position:relative;
}
.owl-controls .owl-prev{
    position: absolute;
    left: -40px;
    bottom: 230px;
    padding: 8px 17px;
    background:#333;
    transition:background 0.50s ease;
}
.owl-controls .owl-next{
    position: absolute;
    right: -40px;
    bottom: 230px;
    padding:8px 17px;
    background:#333;
    transition:background 0.50s ease;
}
.owl-controls .owl-prev:after,
.owl-controls .owl-next:after{
    content:"\f104";
    font-family: FontAwesome;
    color: #d3d3d3;
    font-size:16px;
}
.owl-controls .owl-next:after{
    content:"\f105";
}
.owl-controls .owl-prev:hover,
.owl-controls .owl-next:hover{
    background: #e74c3c;
}
@media only screen and (max-width: 990px) {
    .post-slide{
        margin: 0 20px;
    }
    .owl-controls .owl-buttons .owl-prev{
        left:-20px;
        padding:5px 14px;
    }
    .owl-controls .owl-buttons .owl-next{
        right:-20px;
        padding:5px 14px;
    }
}
@media only screen and (max-width: 767px){
    .owl-controls .owl-buttons .owl-prev{
        left:0px;
        bottom: 260px;
    }
    .owl-controls .owl-buttons .owl-next{
        right:0px;
        bottom: 260px;
    }
}


Теги:
0

Оставить своё мнение

Ваш e-mail не будет опубликован. Обязательные поля помечены *