Alon
Alon

Reputation: 879

Firefox mobile (android) and orientationchange

The event is not working in firefox mobile for android.

How do I detect the orientation change after all?

Upvotes: 4

Views: 2888

Answers (2)

Ophiuchus
Ophiuchus

Reputation: 515

this works like a charm on ff for android

$( window ).resize(function() {
  alert($( window ).height());
});

Upvotes: 0

Corban Brook
Corban Brook

Reputation: 21378

Firefox for Android does not support the orientationchange event but you can achieve the same result by using media query listeners.

var mqOrientation = window.matchMedia("(orientation: portrait)");

// The Listener will fire whenever this either matches or ceases to match
mqOrientation.addListener(function() { self.handleViewportChange(); });

Upvotes: 5

Related Questions