5

Recently started using S1. Developing a web app and trying to listen out for orientation change on iPad.

This works perfectly in full site mode on the iPad

function doOnOrientationChange() {
    switch(window.orientation) {  
        case -90:
        case 90:
        alert('landscape');
        break; 
        default:
        alert('portrait');
        break; 
    }
 }

window.addEventListener('orientationchange', doOnOrientationChange);

// Initial execution if needed
doOnOrientationChange(); 

But only once on initial page load in the S1 app.

Anyone have any suggestions or advice?

2
  • can you simulate an orientation change with Javascript to verify the event listener is working properly? could it be a browser-specific issue? Commented Dec 12, 2013 at 17:02
  • Has anyone found the solution to this? I've tried catching the orientationchange events through normal javascript and using jQuery Mobile but nothing gets triggered. The Salesforce1 guide doesn't provide anything except for Canvas apps.
    – Diego
    Commented Aug 25, 2014 at 21:06

0

You must log in to answer this question.

Browse other questions tagged .