Giter Site home page Giter Site logo

Mobile / Tablet device rotation about xzoom HOT 5 CLOSED

payalord avatar payalord commented on July 30, 2024
Mobile / Tablet device rotation

from xzoom.

Comments (5)

payalord avatar payalord commented on July 30, 2024

Didn't check yet, but orientationchange event is possible to use to run some corrections with xZoom instance i guess.

from xzoom.

payalord avatar payalord commented on July 30, 2024

I'll try to replicate this later on my end here. To see what is possible to do.

from xzoom.

payalord avatar payalord commented on July 30, 2024

I didn't check will this code work or not, but you can try this one:

var instance = $('.xzoom, .xzoom-gallery').xzoom();

var isTouchSupported = 'ontouchstart' in window;

if (isTouchSupported) {
    //Initial orientation value
    var sco1 = 0;

    $(window).bind("resize", function(){
        //90 = landscape, 0 = portrait
        var sco2 = ($(window).width() > $(window).height())? 90 : 0;
        if(sco1 != sco2) {
            sco1 = sco2;

            //Close zoom because orientation just has been changed
            instance.closezoom();
        }
    });
}

from xzoom.

psweeting1 avatar psweeting1 commented on July 30, 2024

I tried and tested this code, unfortunately it didn't work. No errors in my console.

from xzoom.

psweeting1 avatar psweeting1 commented on July 30, 2024

I was able to fix the problem using some Javascript instead of jQuery. I couldn't seem to get Jquery mobile orientationchange to work at all, it created more problems than fixed.

window.addEventListener("orientationchange", function() {
                console.log('Change'); //Show the change in the console
                instance.closezoom(); //close the crashed zoom container
            }, false);

I added this under my touch condition section.

from xzoom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.