我正在尝试使用flexbox在我的内容流中并排放置两个图像.在Chrome/Safari中,它可以正确缩放图像,但在Firefox/IE中,不会考虑宽高比,并且图像会失真.内容流的总宽度取决于浏览器的宽度.当窗口变窄时,需要重新调整图像.
这就是它在Chrome/Safari(WebKit)中的外观:
宽高比受到尊重http://pluto.justdied.com/w2box/data/chrome.PNG
虽然这是它在Firefox/Internet Explorer中的样子:
图像延伸http://pluto.justdied.com/w2box/data/exhibit.PNG
这个2列视图有很长的图像.
HTML标记:
<div class="grid">
<img src="../images/mille_bornes_02.jpg">
<img src="../images/mille_bornes_08.jpg">
</div>
Run Code Online (Sandbox Code Playgroud)
CSS如下:
.grid {
z-index: 1;
margin: 0px 0px 16.5px;
position: relative;
flex-direction: row;
width: 100%;
height: 100%;
display: flex;
padding: 0;
border: 0;
}
.grid img {
position: relative;
display: block;
margin-left: 16.5px;
height: 100%;
width: 100%;
}
.grid > img:first-child {
margin-left: 0px;
}
Run Code Online (Sandbox Code Playgroud)
我试图调整大小,但我仍然在Firefox/IE中出现某种形式的失真.有关如何修复它的任何想法?我希望使用flexbox来避免使用JavaScript来强制它.
两个源图像共享相同的高度和宽度.
所有反馈和帮助将不胜感激!
谢谢!
我正在尝试编写一个函数来规范化数据集中的特征(在0和1之间).我想迭代所有功能并在我标准化时替换值.规范化效果很好,但我无法覆盖之前的值.
Data.prototype.normalize = function(dataset) {
// Get the extent for each feature
for (var feature = 0; feature < this.featureCount; feature++) {
var extent = this.getExtent(feature, dataset),
min = extent[0],
max = extent[1];
// uses extent to normalize feature for all companies
for (var company = 0; company < this.companies.length; company++) {
var value = this.companies[company][dataset][feature],
normalized = this.normalizeValue(value, min, max);
value = normalized;
}
}
}
Run Code Online (Sandbox Code Playgroud)
一切都失败了
value = normalized;
Run Code Online (Sandbox Code Playgroud)
如果我在覆盖它后调试console.log(value),一切似乎都有效,但只在函数范围内.在此范围之外,原始值仍然存在.
data.companies[n] = { features : [1, …Run Code Online (Sandbox Code Playgroud)