使用Li childs制作最近的帖子标签盒 - JavaScript

时间:2018-05-28 14:16:05

标签: javascript html css blogger

我需要帮助才能使RecentPosts Box显示我为5 li:nth-​​childs定义的标签的最后一篇文章。这是关于科技新闻的博客。 Thah一个在网站上出现了最近的帖子,但我希望有最新的帖子,但是通过标签。TRITEK

希望你们能帮助我。非常感谢。



function FeaturedPost(a) {
    (function(e) {
        var h = {
            blogURL: "",
            MaxPost: 5,
            idcontaint: "#featuredpost",
            ImageSize: 500,
            interval: 10000,
            autoplay: false,
            loadingClass: "loadingxx",
            pBlank: "https://3.bp.blogspot.com/-v45kaX-IHKo/VDgZxWv0xUI/AAAAAAAAHAo/QJQf8Dlh3xc/s1600/grey.gif",
            MonthNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
            tagName: false
        };
        h = e.extend({}, h, a);
        var g = e(h.idcontaint);
        var c = h.blogURL;
        var d = h.MaxPost * 200;
        if (h.blogURL === "") {
            c = window.location.protocol + "//" + window.location.host
        }
        g.html('<div id="slides"><ul class="randomnya"></ul></div><div id="buttons"><a href="#" id="prevx" title="prev"></a><a href="#" id="nextx" title="next"></a></div>').addClass(h.loadingClass);
        var f = function(w) {
            var q, k, m, u, x, p, t, v, r, l = "",
                s = w.feed.entry;
            for (var o = 0; o < s.length; o++) {
                for (var n = 0; n < s[o].link.length; n++) {
                    if (s[o].link[n].rel == "alternate") {
                        q = s[o].link[n].href;
                        break
                    }
                }
                if ("media$thumbnail" in s[o]) {
                    u = s[o].media$thumbnail.url.replace(/\/s[0-9]+\-c/g, "/s" + h.ImageSize + "-c")
                } else {
                    u = h.pBlank.replace(/\/s[0-9]+(\-c|\/)/, "/s" + h.ImageSize + "$1")
                }
                k = s[o].title.$t;
                l += '<li><a href="' + q + '" title="' + k + '"><div class="overlayx"></div><img class="random" src="' + u + '" title="' + k + '"><h4>' + k + '</h4>' + t + '</span> ' + m + "</span></div></li>"
            }
            e("ul", g).append(l)
        };
        var b = function() {
            var i = "/-/" + h.tagName;
            if (h.tagName === false) {
                i = "";
                e.ajax({
                    url: c + "/feeds/posts/default" + i + "?max-results=" + h.MaxPost + "&orderby=published&alt=json-in-script",
                    success: f,
                    dataType: "jsonp",
                    cache: true
                })
            } else {
                e.ajax({
                    url: c + "/feeds/posts/default" + i + "?max-results=" + h.MaxPost + "&orderby=published&alt=json-in-script",
                    success: f,
                    dataType: "jsonp",
                    cache: true
                })
            }(function() {
                setTimeout(function() {
                    e("#prevx").click(function() {
                        e("#slides li:first").before(e("#slides li:last"));
                        return false
                    });
                    e("#nextx").click(function() {
                        e("#slides li:last").after(e("#slides li:first"));
                        return false
                    });
                    if (h.autoplay) {
                        var k = h.interval;
                        var l = setInterval("rotate()", k);
                        e("#slides li:first").before(e("#slides li:last"));
                        e("#slides").hover(function() {
                            clearInterval(l)
                        }, function() {
                            l = setInterval("rotate()", k)
                        });

                        function j() {
                            e("#nextx").click()
                        }
                    }
                    g.removeClass(h.loadingClass)
                }, d)
            })()
        };
        e(document).ready(b)
    })(jQuery)
};

function rotate() {
    $('#nextx').click();
};
document.write('')

//<![CDATA[
$(document).ready(function() {
    FeaturedPost({
        blogURL: "https://trit3k.blogspot.com",
        MaxPost: 5,
        idcontaint: "#featuredpost",
        ImageSize: 500,
        tagName: false
    });
});
//]]>
&#13;
#featuredpost {
     width: 1170px;
     overflow: hidden;
     display: block;
     position: relative;
  margin:15px auto;
}
 #slides *{
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
    box-sizing:border-box
}
 #slides ul,#slides li{
    padding:0;
    margin:0;
    list-style:none;
    position:relative
}
 #slides ul{
    height:320px
}
 #slides li{
    width:50%;
    height:100%;
    position:absolute;
    display:none
}
 #slides li:nth-child(1), #slides li:nth-child(2), #slides li:nth-child(3), #slides li:nth-child(4), #slides li:nth-child(5){
    display:block
}
 #slides li:nth-child(1){
    left:0;
    top:0
}
 #slides li:nth-child(2){
    left:50%;
    width:25%;
    height:50%
}
 #slides li:nth-child(3){
    left:75%;
    width:25%;
    height:50%
}
 #slides li:nth-child(4){
    left:50%;
    top:50%;
    width:25%;
    height:50%
}
 #slides li:nth-child(5){
    left:75%;
    top:50%;
    width:25%;
    height:50%
}
 #slides li:nth-child(1) h4 {
    overflow:hidden;
    font-size:20px;
    bottom:18px;
    color:#fff;
    width:auto;
    text-align:center;
    text-transform:uppercase;
    height:auto;
    font-family:Arial;
    line-height:32px;
    left:10;
   margin:0px;
   margin-right:10px;
}
 #slides li:nth-child(1) .label_text {
    font-size:30px;
    display:block;
    bottom:10px;
    left:10px;
     padding:0;
    font-family:Arial;
}
 #slides a{
      background-color:rgba(40,40,40,1);
    display:block;
    width:100%;
    height:100%;
    overflow:hidden
}
 #slides img{
    display:block;
    width:100%;
    height:auto;
    border:0;
    padding:0;
    background-color:#333;
    -moz-transform:scale(1.0) rotate(0);
    -webkit-transform:scale(1.0) rotate(0);
    -ms-transform:scale(1.0) rotate(0);
    transform:scale(1.0) rotate(0);
    transition:all 0.6s linear;
}
 #slides li a:hover img {
   opacity:0.8;
transition:all 0s ease;
-webkit-transition:all 0s ease;
-moz-transition:all 0s ease;
-o-transition:all 0s ease
}
 #slides .overlayx{
   position:absolute;
left:0;
top:0;
z-index:2;
width:100%;
height:100%;
}
 #slides h4{
    position:absolute;
    height: auto;
    bottom:0px;
    font-size:14px;
    font-family:Arial;
    left:10px;
    padding:5px 10px;
    color:#fff;
    z-index:3;
    line-height:20px;
    font-weight:normal;
     background:rgba(60,60,60,0.8);
    text-transform:uppercase;
    margin-right:10px;
   text-align: center;
   border-bottom-color: rgb(8, 176, 255);
border-bottom-style: solid;
border-bottom-width: 3px;
}
 #slides li:nth-child(1) .overlayx{
    display:none;
}
 #slides li:hover .overlayx{
    opacity:0.1;
}
 #slides li:nth-child(2) .overlayx{
    display:none;
}
#slides li:nth-child(3) .overlayx{
    display:none;
}
#slides li:nth-child(4) .overlayx{
    display:none;
}
#slides li:nth-child(5) .overlayx{
    display:none;
}
&#13;
<div id="featuredpost"></div>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

将标记列表 namespace Houses { public static class TV { public static bool isOn; public static void SetOn(){ //do stuff to set attribute isOn } } } ... namespace Houses { public class House { public void CheckTV() { TV.SetOn(); } } } 添加到以下修改后的代码

tagName: ["Android","Inovação","Gaming", "Oreo","SnapChat"]