resize the image according to the portrait and landscape in jquerymobile?

Lakshmanan picture Lakshmanan · Feb 28, 2011 · Viewed 16.3k times · Source

I have to add image on the header and background . Is it possible to set the image automatically resizing according to the screen orientation (portrait and Landscape). I set the image in portrait resolution , But when i change the screen to Landscape the image not resized. Can anyone give me some guidelines?

Answer

JohnTESlade picture JohnTESlade · Mar 1, 2011

Support for this is built into jQuery Mobile. There are two Orientation Classes which are present depending on the current screen orientation:

.portrait {
    /* portrait orientation changes go here! */
}
.landscape {
    /* landscape orientation changes go here! */
}   

Or if you want a javascript event you can bind to orientationchange.