Javascript 基于移动定位的图像高度

Javascript 基于移动定位的图像高度,javascript,jquery,mobile,orientation,image-scaling,Javascript,Jquery,Mobile,Orientation,Image Scaling,我有一个小的移动图像库的问题。当我将方向更改为纵向时,图像太大,无法在屏幕上显示 当方向更改为纵向时,是否可以使用一些javascript使图像适合屏幕?在横向模式下,一切看起来都很好。是的,您可以不使用javascript进行使用 @media screen and (max-width: 450px) { img { width: 30%; } } 试试这个: @media screen and (orientation:portrait) { //

我有一个小的移动图像库的问题。当我将方向更改为纵向时,图像太大,无法在屏幕上显示

当方向更改为纵向时,是否可以使用一些javascript使图像适合屏幕?
在横向模式下,一切看起来都很好。

是的,您可以不使用javascript进行使用

@media screen and (max-width: 450px) {
    img {
        width: 30%;
    }
}
试试这个:

@media screen and (orientation:portrait) {
    //your css code goes here
}

@media screen and (orientation:landscape) {
    //your css code goes here
}