[英]Change first article with big size in Masonry Layout
I am using Masonry to create layout with the width of size in each article is 50% but I want the first element has width of size is 100%. 我正在使用砌筑来创建布局,每篇文章的尺寸宽度为50%,但我希望第一个元素的尺寸宽度为100%。 I use css is first-child but It does not make any effect.
我使用css是第一个孩子,但没有任何效果。 Here is HTML code:
这是HTML代码:
<article class="item" position="absolute">..</article>
<article class="item" position="absolute">..</article>
<article class="item" position="absolute">..</article>
<article class="item" position="absolute">..</article>
Jquery: jQuery:
var init_layout = function() {
var c = $(".blog-masonry"),
a = $(".masonry"),
b = function() {
c.masonry({
itemSelector: ".item"
})
},
d = function() {
a.masonry({
itemSelector: "article.item",
isResizeBound: !1,
isInitLayout: !1
})
};
if (0 != c.size()) $(window).on("load", b);
0 != a.size() && (b = function() {
$("article.item", a).each(function() {
$(this).height($(this).width());
$(".tm-content-inner", this).height($(this).width())
});
a.masonry("layout")
}, $(window).on("load", d), $(window).on("load", b), $(window).smartresize(b))
};
$(function() {
init_layout()
});
Any help for me? 对我有帮助吗? Thank you so much for your attend.
非常感谢您的参加。
There are examples of exactly this on the masonry site. 在石工现场有确切的例子。 You need another class '.item-wide' for example that styles that item to be 100% width.
例如,您需要另一个“ .item-wide”类,以将该项目设置为100%宽度。 It's hard to tell without a proper jsfiddle or codepen example, but check out the masonry docs here
如果没有适当的jsfiddle或Codepen示例,很难说清楚,但请在此处查看砌体文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.