繁体   English   中英

同位素/砖石-左上角没有出现角标记

[英]Isotope/masonry - corner stamp doesn't appear in top left

我在同位素布局中设置了cornerStampSelector属性时遇到问题,但是.corner-stamp元素似乎总是显示在左侧。 我已经将CSS设置为float:就在此元素上,但似乎没有任何区别。 这是我的jQuery代码:

jQuery(function() {
    var jQueryalpha = jQuery('.full-width-isotope #preload-grid');
    var jQuerycontainer = jQuery('.full-width-isotope #full-width-grid'),
            // create a clone that will be used for measuring container width
            jQuerycontainerProxy = jQuerycontainer.clone().empty().css({visibility: 'hidden'});

    jQuerycontainer.after(jQuerycontainerProxy);
    // get the first item to use for measuring columnWidth
    var jQueryitem = jQuerycontainer.find('.item').not('.w2').eq(0);

    jQuery(window).smartresize(function() {
        if (jQuery(window).width() <= 768) {
            var colNumber = 2
        }
        else if (jQuery(window).width() <= 480) {
            var colNumber = 1
        }
        else {
            var colNumber = 4
        }
        var colWidth = Math.floor(jQuerycontainerProxy.width() / colNumber);
        jQuerycontainer.css({
            width: colWidth * colNumber
        })
                .isotope({
                    resizable: false,
                    itemSelector: '.item',
                    masonry: {
                        columnWidth: colWidth,
                        cornerStampSelector: '.corner-stamp'
                    }
                }).isotope('insert', jQueryalpha.find('.item'));
    }).smartresize();

});

CSS如下:

.full-width-isotope .item.corner-stamp {
  background: #888 !important;
  float: right !important;
}
.full-width-isotope .item { background-color: #fff; margin: 0; width: 25%; height: 0; padding-bottom: 19%; float: left; overflow: hidden; position: relative; color: #222; height: 275px;}
.item.w2 { width: 50%; }
.item.h2 { height: 550px; }
.full-width-isotope .item-container { position: absolute; top: 12px; bottom: 12px; left: 12px; right: 12px; background-repeat: no-repeat; background-position: center center; background-size: cover;}
.full-width-isotope .item-container > a { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
.full-width-isotope .item-content { background: #FC0; display: block; position: absolute; bottom: 0; left: 0; padding: 10px; font-size: 13px; max-width: 70%; opacity: 0.85}
.full-width-isotope .item-content-hover {
    background: #FC0;
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    top: 0;
    right: 0;
    padding: 10px;
    font-size: 13px;
    opacity: 0.85;
    display: none;
    overflow: hidden;
}
.full-width-isotope * {
    color: #54301b;
}

.full-width-isotope .item-container:hover .item-content {
    display: none;
}
.full-width-isotope .item-container:hover .item-content-hover {
    display: block;
}

的HTML

<div class="full-width-isotope">
    <!-- SERVICE BOXES -->
    <div id="preload-grid">
        <div class="item corner-stamp"></div>
        <div class="item">
            <div class="item-content">
            </div>
        </div>

        <div class="w2 h2 item">
            <div class="item-content">
            </div>
        </div>
        <div class="item">
            <div class="item-content">
            </div>
        </div>
        <div class="item">      
            <div class="item-content">
            </div>
        </div>
        <div class="w2 h2 item">
            <div class="item-content">
            </div>
        </div>
        <div class="item">
            <div class="item-content">
            </div>
        </div>
    </div>
    <div id="full-width-grid"></div>
</div>

您的边角印章不应具有“ item”类

<div class="item corner-stamp"></div>

应该

<div class="corner-stamp"></div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM