jQuery砌體是偉大的,但是,有沒有人能夠獲得角落郵票出現在頁面的左上角?我嘗試更改爲float: left;
,但這似乎不起作用。jQuery梅森角落郵票
此外,當我調整窗口的大小時,調整大小不會自動調整角標。
這裏的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'
});
});