Html googlephotos的纯css实现
我正试图完成谷歌照片的相同布局,并来到这个页面。我的问题是关于他的作品的最终成果,可以在这一页上看到。当你检查其中一张照片时,你可以看到这条线Html googlephotos的纯css实现,html,css,flexbox,Html,Css,Flexbox,我正试图完成谷歌照片的相同布局,并来到这个页面。我的问题是关于他的作品的最终成果,可以在这一页上看到。当你检查其中一张照片时,你可以看到这条线 <div ng-repeat="img in imgs" style="flex-grow:70.57291666666667;flex-basis:169.375px;" class="ng-scope"> <img ng-src="stock-photo-34598868.jpg" src="stock-photo-34598
<div ng-repeat="img in imgs" style="flex-grow:70.57291666666667;flex-basis:169.375px;" class="ng-scope">
<img ng-src="stock-photo-34598868.jpg" src="stock-photo-34598868.jpg">
</div>
我的问题是,他使用了什么计算来获得flex grow和flex basis的值,因为教程中没有提到它?这里您可以看到,使用jQuery,我模拟了flex grow效果,如角度版本中所示
$('img').each(function() { //Cycle all the images
var img = $(this);
//Apply flex settings
img
.css('flex-grow', img.width() * 100 / img.height())
.css('flex-basis', img.width() * 240 / img.height() + 'px');
});
这确实是你应该直接问开发人员的问题。查看页面,你可以看到它是用Angular制作的,flex增长因子是
style=“flex grow:{{{img.width*100/img.height}};flex basis:{{{img.width*240/img.height}}px;“>
@Blazemonger,谢谢,我已经这么做了。只是在等他的答复。把它贴在这里,以防有人知道。@LucaDeNardi,谢谢,我会试试的。谢谢,这就是我要找的。你真棒。