简体   繁体   English

调整iScroll 4的大小以适合所有设备上的100%

[英]resize iScroll 4 to fit 100% on any device

I'm trying to resize my wrapper, so when viewed on iPhone, iPad or computer 100% of my site is in view. 我正在尝试调整包装纸的大小,因此在iPhone,iPad或计算机上查看时,可以看到我网站的100%。 I have placed pictures in my scroller using the <ul> and <il> methods. 我已使用<ul><il>方法将图片放置在滚动条中。
At the moment everything is in view on my computer, but on iPhone the pictures are getting cut off. 目前,我的计算机上的所有内容都可以查看,但是在iPhone上,图片被截断了。 It's letting me scroll horizontally and vertically my pictures, but need to resize the wrapper so my pictures are smaller. 它使我可以水平和垂直滚动图片,但是需要调整包装的大小,以便图片更小。
Any help would be amazing. 任何帮助都将是惊人的。 Cheers in advance 提前加油

You didn't provide any codes, so these maybe help you: 您没有提供任何代码,因此这些代码可能会帮助您:

  1. Set proper width/height to your wrapper when browser resizes and window.onload. 当浏览器调整大小和window.onload时,为包装器设置适当的宽度/高度 Because we don't know device is in landscape or portrait mode until window.onload . 因为直到window.onload,我们才知道设备处于横向或纵向模式。 Here better explained how to get resized browser width/height. 这里更好地解释了如何调整浏览器的宽度/高度。
  2. Check your images width/height . 检查图像的宽度/高度 Maybe images' dimensions wider than wrapper . 也许图像的尺寸比包装纸宽。 You can set width/height to image in percent. 您可以将宽度/高度设置为以百分比表示的图像。
  3. And don't forget refresh iScroll when browser resizes. 并且不要忘记在调整浏览器大小时刷新iScroll。 You can do it like that: 您可以这样做:

    setTimeout(function(){myScroller.refresh()}, 400); // browser need time to rotate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM