Blogger Beşli Owl Carousel tarzı Slider (Manşet) Widget

Yazı Boyutu Ayarla büyüt (A+) (A-) küçült


Blogger panelinde Düzen > HTML/JavaScript Ekle kısmına aşağıdaki kodun tamamını yapıştır:
blogger,slider,carousel


<link href='https://fonts.googleapis.com/css?family=Oswald:400,700|Roboto:400,700' rel='stylesheet' type='text/css'/>

<style>
/* NewsPro Ana Izgara Yapısı */
#newspro-grid-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr; /* 3 Sütunlu yapı */
    grid-template-rows: 200px 200px;    /* 2 Satırlı yapı (Toplam 400px) */
    gap: 4px;
    margin: 20px 0;
    width: 100%;
    box-sizing: border-box;
}

/* Sol Büyük Kutu (1. Yazı) */
.np-grid-box:nth-child(1) {
    grid-column: 1 / 2;
    grid-row: 1 / 3; /* 2 satır yüksekliğinde */
}

/* Diğer Kutular (2, 3, 4 ve 5. Yazılar) */
.np-grid-box {
    position: relative;
    overflow: hidden;
    background: #111;
}

.np-grid-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.np-grid-box:hover img {
    transform: scale(1.1);
}

/* Bilgi Katmanı */
.np-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    z-index: 2;
}

.np-tag {
    background: #e74c3c; /* Orijinal NewsPro Kırmızısı */
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 11px;
    padding: 2px 8px;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 10px;
}

.np-title-link {
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    text-decoration: none;
    display: block;
    line-height: 1.2;
    text-transform: uppercase;
}

/* Boyutlara göre font ayarı */
.np-grid-box:nth-child(1) .np-title-link { font-size: 24px; }
.np-grid-box:not(:first-child) .np-title-link { font-size: 14px; }

/* Mobil Tasarım (Alt alta dizilim) */
@media (max-width: 850px) {
    #newspro-grid-container {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 300px 150px 150px;
    }
}
@media (max-width: 500px) {
    #newspro-grid-container {
        display: block;
    }
    .np-grid-box { height: 250px; margin-bottom: 4px; }
}
</style>

<div id="newspro-grid-container">
    </div>

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(document).ready(function() {
    // Son 5 yazıyı çeker (1 Büyük + 4 Küçük için)
    $.ajax({
        url: '/feeds/posts/default?alt=json&max-results=5',
        type: 'get',
        dataType: 'jsonp',
        success: function(data) {
            var res = '';
            for (var i = 0; i < data.feed.entry.length; i++) {
                var entry = data.feed.entry[i];
                var title = entry.title.$t;
                var url = entry.link.find(l => l.rel === 'alternate').href;
                var img = entry.media$thumbnail ? entry.media$thumbnail.url.replace('s72-c', 's1600') : 'https://via.placeholder.com/600x400';
                var cat = entry.category ? entry.category[0].term : "News";

                res += '<div class="np-grid-box">' +
                       '<a href="' + url + '">' +
                       '<img src="' + img + '" alt="' + title + '"/>' +
                       '<div class="np-overlay">' +
                       '<span class="np-tag">' + cat + '</span>' +
                       '<span class="np-title-link">' + title + '</span>' +
                       '</div>' +
                       '</a>' +
                       '</div>';
            }
            $('#newspro-grid-container').html(res);
        }
    });
});
</script>

0 Yorum:

Yorum Gönder