Timblebop
Timblebop

Reputation: 47

Is it possible to hide / show div based on orientation change javascript / query

something like:

if orientation = landscape { hide divA else show divA}

excuse non script example, thought it would be easier to explain that way as not too sure the best way to go about it

Upvotes: 2

Views: 1589

Answers (1)

kasper Taeymans
kasper Taeymans

Reputation: 7026

Yes you can do this with css media queries.

jsfiddle demo (Make the width of the html view smaller and see what happens)

@media all and (orientation:portrait) {  
    /* Styles for Portrait screen */  
}  
@media all and (orientation:landscape) {  
    /* Styles for Landscape screen */  
}  

Upvotes: 3

Related Questions