絶対にこれで私の髪を引っ張ります。GitHubで提供されている白黒のソリューションはないようです。これは奇妙です。なぜなら、それはかなり単純な概念のように思えるからです。たぶん、私はそれを理解していません。
基本的に、私は流動的でレスポンシブなポートフォリオを作成しようとしています.Isotopeを使用してアイテムをフィルタリングしています. フィルタリングは正常に機能し、4 つの列は完全に流動的で、ウィンドウのサイズを変更するとすべてが見栄えがします。
ただし、モバイルおよびタブレット レイアウトの場合は、4 列のレイアウトから2列のレイアウトに変更するだけです。
私はこれを試しました:
$(window).load(function(){
var $container = $('#thumbs');
$container.isotope({
filter: '*',
animationOptions: {
duration: 750,
easing: 'linear',
queue: false,
},
});
// initialize Isotope
$container.isotope({
// options...
resizable: false, // disable normal resizing
// set columnWidth to a percentage of container width
masonry: { columnWidth: $container.width() / 4 },
});
// update columnWidth on window resize
$(window).smartresize(function(){
$container.isotope({
// update columnWidth to a percentage of container width
masonry: { columnWidth: $container.width() / 4 }
});
});
// My attempt at using media queries to change 'columnWidth'
$(window).resize(function() {
var width = $(window).width();
if (width < 768) {
$container.isotope( {
// update columnWidth to half of container width
masonry: { columnWidth: $container.width() / 2 }
});
}
});
});
うまくいきませんでした:(
どんな助けでも大歓迎です。