BS
Orientation change Event not found
by Bharat Sharma - Tuesday, 29 April 2014, 1:29 PM
 

Hello,

I was trying to find out a event for orientation change (mobile rotation portrait/landscape ) in adapt framework but i found no implementation for this?

So i was trying to add a jQuery mobile lib for same, but I didn't get success. Can anyone please guide me how i can add this library particularly in adapt framework.

thanks

Bharat

Picture of Daryl Hedley
Re: Orientation change Event not found
by Daryl Hedley - Wednesday, 30 April 2014, 3:20 PM
 

Hey Bharat,

Currently Adapt doesn't support orientation change as it's not well supported across browsers. However if we receive enough calls for this then we will consider putting it in.

For now I would suggest looking over this documentation to familiarise yourself with the Adapt.device object.

You could build a plugin that listens to these Adapt.device events and work out the orientation change.

Hope this helps!

Thanks,

Daryl

 

BS
Re: Orientation change Event not found
by Bharat Sharma - Thursday, 1 May 2014, 9:59 AM
 

Thanks Daryl,

I need this feature for mobile, because i was trying to run video on full screen mode when mobile rotates from portrait to landscape.

Jquery.mobile gives orientation change event but adapt framework not using jquery mobile library. 

bharat

 

 

 

 

Picture of Chris Jones
Re: Orientation change Event not found
by Chris Jones - Thursday, 1 May 2014, 10:56 AM
 

Hi Bharat,

It wouldn't be a lot of code to write a plugin that includes jquery mobile and listens for the jquery event, then fire Adapt.trigger('orientation:change', 'landscape').

Cheers,

Chris

BS
Re: Orientation change Event not found
by Bharat Sharma - Thursday, 1 May 2014, 12:28 PM
 

Hi Chris

I was trying this at very first, but whenever i was trying to include jquery mobile, framework stopped working for me, it was not showing any error while build!

I tried to include something like:

var ComponentView = require('coreViews/componentView');
var Adapt = require('coreJS/adapt');
var JqueryM = require("components/adapt-xyz/js/jquery.mobile");

rest code...

Can you correct me if i am doing something wrong here?

Bharat

 

 

Picture of Daryl Hedley
Re: Orientation change Event not found
by Daryl Hedley - Thursday, 1 May 2014, 1:53 PM
 

Hey Bharat,

Have a look at this tutorial:

http://pixelhunter.me/post/28843693624/detect-orientation-jquery

Thanks,

Daryl

Picture of Chris Jones
Re: Orientation change Event not found
by Chris Jones - Thursday, 1 May 2014, 2:23 PM
 

Can't tell for sure without the source code but I always use a relative path for locally included modules.

https://gist.github.com/cajones/a7d09065796c491dcba6

 

 

 

Picture of Chris Jones
Re: Orientation change Event not found
by Chris Jones - Thursday, 1 May 2014, 3:59 PM
 

So I updated the Gist to include the code to track orientation change.

Enjoy!

 

Picture of Matt Leathes
Re: Orientation change Event not found
by Matt Leathes - Monday, 12 May 2014, 11:42 AM
 

Do you need to use JQuery Mobile for this? DeviceOrientation events seem pretty well supported on mobile browsers...

Good tutorial here: http://www.sitepoint.com/using-device-orientation-html5