Jump to content

If I have two columns, live orientation response


greenace92

Recommended Posts

Hello,

 

I have a pretty basic two panel design, no code yet but it is pretty straight forward

 

What I'm concerned about is how a website can react to an orientation change, not simply be re sizing but by relocating items. 

 

So in portrait mode, I have panel a, the top half say 50%, and panel b, 50% bottom half

 

I rotate it (the phone) to the left of my perspective (viewer) and the top panel goes to the left, and the bottom panel goes to the right. 

 

In the meantime some scrolling animation is in play and the direction of the scroll changes, from sideways to up and down...

Is that possible without refreshing the page? 

You can do media queries on the width and height of the browser, or use JavaScript and attach a Listener to the window.matchMedia() object:

var devOr = window.matchMedia("(orientation: portrait)");
// The Listener will fire whenever this either matches or ceases to match
devOr.addListener(function(){
	$('.column_1').css({
		float:'none'
	});
});

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.