石積みのレイアウトでガター幅を使用しているときに、小さな、しかし非常に苛立たしい問題があります。クリック関数で (すべての行の後に) クリア div にコンテンツを追加してから、石積みをリロードしてグリッドに含めます。ただし、小さな問題は、div をクリックすると、コンテナーの右側が 1 秒程度切り落とされたように見えることです。プロパティをjqueryから取り出してスタイルに置き換えると問題が解決した
ことに気付きましたが、複数のサイズのdiv(100%幅を含む)を追加するので、gutterwidthsを使用する必要があるので、何もしたくありませんギャップ。jsfiddle のデモを次に示します (div をクリックしたときにコンテナーの右側を見てください)。gutterwidth
margin-left
margin-right
http://jsfiddle.net/SzK5F/5/
jQuery:
$(document).ready(function() {
var $container = $('#block-wrap');
$(function(){
$container.imagesLoaded(function(){
$('#block-wrap').masonry({
itemSelector : '.content-block-small, .content-block-big, .listing-item, .preview-listing:not(.excluded)',
columnWidth: 3,
gutterWidth: 15,
isFitWidth: true,
isAnimated: true
});
});
});
});
$(document).ready(function () {
$(".listing-item").click(function () {
$('.listing-properties').hide();
var previewForThis = $(this).nextAll('.preview-listing:first');
var otherPreviews = $(this).siblings('.preview-listing').not(previewForThis);
otherPreviews
.addClass('excluded') // exclude other previews from masonry layout
.hide();
previewForThis
.removeClass('excluded')
.append($('#property' + $(this).attr('hook')).show())
.hide()
.delay(400)
.fadeIn("slow");
setTimeout(function(){
$('html, body').animate({ scrollTop: previewForThis.offset().top-20 }, "slow");
}, 500);
$('#block-wrap').masonry('reload');
});
});
私が見逃しているのは明らかなことかもしれませんし、ガター幅を使用している間はまったく修正できないかもしれません (うまくいけば修正できます) が、少しイライラします。