如何显示离子应用程序的整页图像
问题描述:
我在我的应用程序中使用离子选项卡模板&有一个页面的完整图像,该图像得到形式的JSON响应。如何显示离子应用程序的整页图像
这里是我的html代码
<ion-content class="padding">
<img src="{{img}}" alt="" class="full-image">
</ion-content>
我的问题是如何处理在不同的设备上的图像分辨率。 如果任何一个有想法,请与我分享
答
我想处理在不同设备中的图像和我这样做是在我的控制器:
$scope.width=$window.innerWidth*0.65;//65% of the width
//change the percentage to fit your goals
$scope.height=$window.innerHeight*0.65; //65% of the height
//change the precentage to fit your goals
,并在html的使用这样的:
<img ng-src={{image.src}} height={{height}} width={{width}} />
我不知道这是最好的方法,但它的工作原理!
[this](http://codepen.io/rdelafuente/pen/tJrik)可能会有帮助。 –
你不必担心解决办法,CSS可以适合你。看看这个链接:https://css-tricks.com/perfect-full-page-background-image/ – Nirus
谢谢css技巧对我的问题非常有用 –