我正在努力创造一个具有不同尺寸图像的AMP-Carousel。我想将旋转木马中的图像缩放到自动宽度的固定高度&。AMP-Carousel具有不同的图像尺寸
文档中提供的示例都具有相同的宽度/高度。
我试过忽略了使用layout =“fixed-height”的amp-img元素&的宽度,但那根本没用。文档非常混乱。
<amp-carousel width=500 height=300>
<amp-img src="http://placehold.it/200x600" width=200 height=600></amp-img>
<amp-img src="http://placehold.it/700x550" width=700 height=550></amp-img>
<amp-img src="http://placehold.it/340x410" width=340 height=410></amp-img>
</amp-carousel>
我已经创建了一个JS-小提琴告诉你什么是我有&我想要的
https://jsfiddle.net/ag38afa7/
编辑:
的样式没有与文档一致或者我不明白他们?
在放传送带页,它说:Layout not supported for: responsive
但演示页面上的AMP-IMG元素有layout="responsive"
https://ampbyexample.com/components/amp-carousel/
您需要使用“固定高度”布局类型。该元素占用可用空间但保持高度不变。 width属性不能出现或者必须等于auto.Check [示例](https://github.com/ampproject/amphtml/tree/ef00e97ddcee7fb96398f656c53a4c60523829d4)。 – abielita
这不适合我,请从下面的答案中看到我更新的jsfiddle:http://jsfiddle.net/ag38afa7/1您可以使用解决方案更新jsfiddle吗? –
我有同样的问题,你找到一个解决方案? –