我在使图像占用不超过父容器可用宽度的100%时遇到了一些麻烦.我只注意到Firefox 36(不是IE或Chrome)中的问题.那么它是一个firefox bug还是我错过了什么?
注意:图像不应大于原始大小.
铬:

火狐:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.container {
width:300px;
}
.flexbox {
display:flex;
}
.flexbox .column {
flex:1;
background-color: red;
}
.flexbox .middleColumn {
flex:3;
}
.flexbox .middleColumn img {
width:auto;
height:auto;
max-width:100%;
max-height:100%;
align-self: center;
display: block;
}
</style>
</head>
<body>
<div class="container">
<div class="flexbox">
<div class="column">This is the left column!</div>
<div class="middleColumn">
<img src="http://placehold.it/400/333333">
</div>
<div class="column">This is the right column!</div>
</div>
</div>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
我正在使用Durandal 1.2和Durandal路由器插件,并希望通过Google Analytics跟踪SPA中的网页浏览量:
window._gaq.push(['_trackPageview', location.pathname + location.search + location.hash]
我知道我可以监听hashchange事件,甚至可以通过Sammy进行连接.我宁愿不这样做,因为Durandal目前正在被重写以消除对Sammy的依赖.
我的问题是,有没有办法使用Durandal路由器插件设置它?