problem with centering image in popup
hi guys,
I am using jqm to developer a simple web app for my company, which includes a sequence of images that will popup when users click on them.
My problem is when I click on the images, jqm suppose will help to center the popup image, but mine is not.
The position is not proper, especially when I keep clicking other images one by one. And the scale of the first-popped image will not be scaled to fit the screen....
However, if I change the browser size, the image will be centered again...
I just use the sample code from the jqm document.
- $( ".photopopup" ).on({
- popupbeforeposition: function() {
- var maxHeight = $( window ).height() - 60 + "px";
- var maxWidth = $( window ).width() * 0.8 + "px";
- $( ".photopopup" ).css( "max-height", maxHeight );
- $( ".photopopup" ).css( "max-width", maxWidth );
- console.log( maxWidth+ ' ' + maxHeight);
- }
- popupatferclose: function() {
- $(".photopopup img").attr("src",'');
- // $( ".photopopup" ).popup('close') ;
- }
- });
here is my testing link
Thanks for helping~