jQuery Masonry 很棒,但是,有没有人能够让角落标记出现在页面的左上角?我尝试更改为,float: left;
但这似乎不起作用。
此外,当我调整窗口大小时,调整大小不会自动调整角戳。
这是CSS
.corner-stamp {
width: 270px;
height: 300px;
padding: 10px;
float: right;
background: red;
color: white;
-moz-border-radius: 15px 0px 15px 0px;
-webkit-border-radius: 15px 0px 15px 0px;
border-radius: 15px 0px 15px 0px;
}
这是JS:
$.Mason.prototype.resize = function() {
this._getColumns();
this._reLayout();
};
$.Mason.prototype._reLayout = function(callback) {
var $cornerStamp, cornerStampX, freeCols, i;
freeCols = this.cols;
if (this.options.cornerStampSelector) {
$cornerStamp = this.element.find(this.options.cornerStampSelector);
cornerStampX = $cornerStamp.offset().left - (this.element.offset().left + this.offset.x + parseInt($cornerStamp.css("marginLeft")));
freeCols = Math.floor(cornerStampX / this.columnWidth);
}
i = this.cols;
this.colYs = [];
while (i--) {
this.colYs.push(this.offset.y);
}
i = freeCols;
while (i < this.cols) {
this.colYs[i] = this.offset.y + $cornerStamp.outerHeight(true);
i++;
}
this.layout(this.$bricks, callback);
};
$container = $("#streams");
$container.imagesLoaded(function() {
$container.masonry({
itemSelector: ".stream-item",
columnWidth: 60,
isAnimated: false,
isFitWidth: true,
cornerStampSelector: '.corner-stamp'
});
});