如何在jquery移动Web应用程序中将纵向和横向屏幕方向的图像尺寸设置为相同?
我必须在标题和背景上添加图像我使用以下代码添加了标题图像,
<div data-role="header" data-nobackbtn="false" data-theme="a" style="height:30px;background-image:url(test.jpg);background-repeat:no-repeat;">
图像完美地固定在纵向中,但是当屏幕更改为横向时,图像未完美固定,图像后会添加一些空白。那么如何将纵向和横向屏幕方向的图像设置为相同。此问题出现在Android、iPhone、黑莓等设备上。如需更多说明,请检查图像标题。
实际上,当设置宽度:自动或100%时不起作用,因为图像有一些固定宽度,例如我将图像宽度设置为纵向360像素,当更改为横向时图像宽度仍然相同,这就是问题。我们不能将横向宽度设置得较大,因为我们不能说所有平台的横向模式屏幕尺寸都是相同的。在 Android、iPhone 等设备中可能会有所不同。
I have to add image on the header and background I added header image using following code
<div data-role="header" data-nobackbtn="false" data-theme="a" style="height:30px;background-image:url(test.jpg);background-repeat:no-repeat;">
the image perfectly fixed in the portrait but when the screen changed to the landscape, image not fixed perfectly there will be some blank space added after the image. So how to set the image same for both portrait and landscape screen orientation. This problem occur in Android,iphone ,blackberry ,etc. For more clarification please check the image header.
actually when set the width: auto or 100% is not working ,because the image has some fixed width for example I set image width as 360 px in portrait ,when change to the landscape the image width still same thats the problem. We can't set the width large for landscape because we can't say that all platforms landscape mode screen size is same. that may be varying in Android,iphone etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以设置一个 div 标签来隐藏溢出,然后在 div 内设置一个常规的 img 标签,并将两者的宽度设置为 100%...
一些注意事项:
You can set a div tag to hide overflow, then set a regular img tag inside the div and set both to have a width of 100%...
Some Notes: