I have an app which shows a list of thumbnails with some data. When the user taps on a list item I go to a new state where I wish to show the image in full screen and show the image title and a few other things.
The problem I am having is that I do not know how to display the image full screen in a consistent manner. Depending on the aspect ratio of the image, it may or ay not take up the full view. Ideally I’d love for it to take up the full view but without stretching it.
If this isn’t possible I’d like an entirely black background where I can center the image.
I cannot achieve this either, I’ve tried adding a black background to the ionic-content in CSS but it seems that only extends to just under the image, since the image container isn’t full screen, the black background doesn’t extend all the way to the bottom of the view.
I also tried using a popup to display the image, but I cannot get that to work in a full screen setting either. The popup starts from the center of the screen and shows an image which far extends the borders of the screen.
Thanks for that example! It would be great if it was possible to drag right/left in order to view next/previous images. Do you know if it’s possible? I appreciate your help.
The last solution looks good on a large screen, but on a smaller one the backdrop is not triggered, so the comments are barely readable if the background is white.
I tried to put a backdrop manually, and messed the css a bit but could not find how to do that. Any ideas ?
You are right. Looks like in the latest version the backdrop is only visible for widths equal or greater than 680px. I’ve updated the example to fix that.
this may be a bit off-topic, but in your example using the ion-slide-box the first picture is always displayed first. I’d like the popup to open on the correct slide, i.e. when the user taps the 3rd photo of a list, the popup starts in the 3rd photo index.
I tried using $ionicSlideBoxDelegate.slide after the popup is shown, without success: the folowing error happens:
TypeError: Cannot read property 'length' of undefined
at circle
Oops. I put all methods in the .then() callback called when the $ionicModal.fromTemplateUrl completes. Re-organizing my code fixed the problem. Thanks for the code update!