Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zooming not working in android #354

Closed
rambo123 opened this issue Jul 21, 2012 · 27 comments
Closed

zooming not working in android #354

rambo123 opened this issue Jul 21, 2012 · 27 comments

Comments

@rambo123
Copy link

Thank you for PhotoSwipe.
I am using jquery-1.6.4.min.js,code.photoswipe.jquery-3.0.5.min.js,jquery.mobile-1.0rc2.min.js , there is no error except zooming in android.
Pinch and zoom works in ipad,iphone why its not working in android. solutions please.........

@pixelfreak
Copy link

I don't think this has ever worked for Android. I know...the description for this framework is misleading, saying it is compatible with Android. It's using gesture event that is not supported.

But it can be done using the basic touch events (on v4.x anyway, I think it doesn't work below that. On 2.x, event.touches always return 1).

I wonder if anyone has forked and added this.

@rambo123
Copy link
Author

thank you so much for your message sir.

On Thu, Jul 26, 2012 at 5:44 AM, pixelfreak
reply@reply.github.com
wrote:

I don't think this has ever worked for Android. I know...the description for this framework is misleading, saying it is compatible with Android. It's using gesture event that is not supported. But it can be done using the basic touch events. I wonder if anyone has forked and added this.


Reply to this email directly or view it on GitHub:
#354 (comment)

@pjsb
Copy link

pjsb commented Sep 24, 2012

@pixelfreak do you find someone who has adopted it to android? would be a cool feature

@pixelfreak
Copy link

Nope. If you find it, let me know too :)

@agliottone
Copy link

I have add hammerjs and transitjs, and create addAndroidZoom function and works well!!!

@pixelfreak
Copy link

Pull request?

@binaya-pradhan19
Copy link

How to implement addAndroidZoom in photoswipe?

@agliottone
Copy link

download and unzipped this http://darioagliottone.it/files/ps.zip
there are js files. include in your html:

<script type="text/javascript" charset="utf-8" src="code.photoswipe-3.0.5.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.transit.js"></script>
<script type="text/javascript" charset="utf-8" src="hammer.js"></script>
<script type="text/javascript" charset="utf-8" src="jquery.hammer.js"></script>

enjoy :)))

@binaya-pradhan19
Copy link

hi agllottone thanks for ur help.....it is super.....

@cuxxie
Copy link

cuxxie commented Mar 10, 2013

yes i can see the pinch zoom looks fine but the photoswipe doesnt show any image after i attached the code. any idea how to solve that? thanks

if i remove this then the pinch zoom will works fine but the photoswipe wont load at all. while if i use this then the photoswipe will only show blank image
<script type="text/javascript" chaset="utf-8" src="../lib/klass.min.js"></script>

@agliottone
Copy link

post your code :)

@adiepev
Copy link

adiepev commented Apr 4, 2013

Where can I find your zip files?

@agliottone
Copy link

sorry, try again http://darioagliottone.it/files/ps.zip

@adiepev
Copy link

adiepev commented Apr 4, 2013

Dario,

Thank you very much, I'll try it out.

Regards from the Netherlands.,

Alex Diepeveen

Tel: 035-6952476

Mob: 06-27416981


Van: Dario Agliottone [mailto:notifications@github.com]
Verzonden: donderdag 4 april 2013 20:28
Aan: codecomputerlove/PhotoSwipe
CC: adiepev
Onderwerp: Re: [PhotoSwipe] zooming not working in android (#354)

sorry, try again http://darioagliottone.it/files/ps.zip

Reply to this email directly or view
<#354 (comment)
4862> it on GitHub.
<https://github.com/notifications/beacon/NonmGGp1Lu2IFaW6gBeFHbM6PibqIBzcxqO
ZLkuGqZuTNFZvW15Jnf-LOZZ4Kbsd.gif>


Geen virus gevonden in dit bericht.
Gecontroleerd door AVG - www.avg.com
Versie: 2013.0.3267 / Virusdatabase: 3161/6218 - datum van uitgifte:
04/01/13

@abudayah
Copy link

abudayah commented Apr 5, 2013

anyone know how to use multitouch zoom ?

@hunag-yean
Copy link

i have one question

how to enlarge jpg image without distortion

in ios and android

@angelarted
Copy link

Hi Dario Agliottone,
I tried to add those scripts you suggest to my PhoneGap app, but it still doesn't work. Any idea about the reason?
Thank you very much

@agliottone
Copy link

no. I use it in phonegap application too

@angelarted
Copy link

I'll leave my code so someone can help me how to do it.
I've used hammer and transit, but still can get it work correctly. In detail, it zooms, but zooms all the images, not only the visible one, and, moreover, it's not draggable (so I can't view it all). I tried with several plugins (like pep.js) but, since I cannot reach the image directly, I cannot apply them to it. (the ui-overlay masks them).
Here's my code.
Where do I wrong?
I used PhoneGap and JqueryMobile

var currentPage = $.mobile.activePage;

var   options = {
    enableMouseWheel        : false , 
    enableKeyboard          : false, 
    captionAndToolbarOpacity: 1,
    backButtonHideEnabled   : false,   //do not modify - causes android crash
    allowUserZoom           : true,
    getImageMetaData        : function(el){
                                            return{
                                               id  : el.getAttribute('id')
                                            }
                                        }
    },

photoSwipeInstance = $('#lstImages a',e.target).photoSwipe(options,currentPage.attr('id'));

photoSwipeInstance.addEventHandler(window.Code.PhotoSwipe.EventTypes.onDisplayImage,function(e){

      //TO CLOSE GALLERY AND STAY IN PAGE ON ANDROID PHISICAL BACK BUTTON
       document.addEventListener('backbutton',function(e){
        e.preventDefault();
             window.Code.PhotoSwipe.activeInstances[0].instance.hide(); 
             window.location.hash = $.mobile.urlHistory.getActive();
    },false)

   //THIS SETS VARIABLES TO CATCH CURRENT IMAGE IN GALLERY
    var currentImage = photoSwipeInstance.getCurrentImage();
    var id = currentImage.metaData.id;
    var $img = $('.ps-carousel-item-'+id+' img');
    var $wrap = $('.ps-carousel-'+id);


    //THIS SETS THE BEHAVIOUR ON HAMMER GESTURE
    $('.ps-uilayer').hammer({prevent_default:true}).on('pinchin pinchout',function(e){
        e.stopPropagation();
        e.gesture.stopPropagation();
        e.gesture.stopDetect();


       //THIS IS THE BEHAVIOUR: IT IS APPLIED TO ALL THE IMAGES INSTEAD OF THE CURRENT ONE. WHY?
        switch(e.type){
           case 'pinchout':
           $img.transition({scale: 2}); 
        break;
           case 'pinchin':
           $img.transition({scale: 1});
        break;
            }       
    })
    $img.pep(); //THIS IS THE ATTEMPT TO MAKE IMG DRAGGABLE
});

@yrancillac
Copy link

@agliottone : Thx it's working very well.

@agliottone
Copy link

👍

@emilzaki
Copy link

Dear agliottone, could you please post the whole thing as the attached script doesn't work!
Thanks

@andreinitescu
Copy link

has anyone managed to make it work on Windows 8 IE11 as well?

@dimsemenov
Copy link
Owner

@nitescua, do you test on desktop or mobile IE11? On what exactly device?

@andreinitescu
Copy link

@dimsemenov on a Windows 8.1 tablet with IE11

@andreinitescu
Copy link

I have a deadline and I'm struggling trying to convert the code done by @agliottone

@dimsemenov
Copy link
Owner

@nitescua, entirely new version of Photoswipe will be released this week (at least I hope so), please email me to diiiimaaaa@gmail.com and I'll send you private link to beta, and you'll test if it works correctly there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests