简体   繁体   English

为什么从移动电话打开我的网站时速度很慢,而从桌面打开它却能正常运行?

[英]Why is my website very slow when it is opened From Mobile Phone but runs fine while it is opened from Desktop?

I have an interactive website completely built on HTML5 Canvas and Javascript using Kineticjs framework and Foundation to make it responsive. 我有一个完全基于HTML5 CanvasJavascript的交互式网站,使用Kineticjs框架和Foundation使之响应。 I have also added Preloader to load all the images which are used for animation. 我还添加了加载器,以加载用于动画的所有图像。 So when the website loads at first it loads around 500-600 images before showing homepage. 因此,当网站最初加载时,它会在显示首页之前加载约500-600张图片。 Now the problem is when i run the website in laptops and desktops it works just fine, nothing is wrong but when i run it from any mobile and tablets it starts to respond very very slowly and looks like it got stuck. 现在的问题是,当我在笔记本电脑和台式机上运行该网站时,一切正常,但没有错,但是当我从任何手机和平板电脑上运行该网站时,它的响应速度都非常缓慢,看起来好像卡住了。 Even it runs smoothly when i run it from google chromes mobile emulator but is very slow on mobile devices. 当我从google chromes移动模拟器运行它时,即使它运行也很流畅,但在移动设备上却非常慢。

Is preloader making my site slow or is it Kineticjs?? 是预加载程序使我的网站变慢还是Kineticjs?

Loading 500-600 images is simply a design error. 加载500-600张图像只是一个设计错误。
Especially since the user is simply not able to look at them at once. 特别是因为用户根本无法立即看他们。
It happens that desktop/network are so fast that it still works here. 碰巧桌面/网络是如此之快,以至于它仍然可以在这里工作。
But a smartphone is at least 20X slower, and mobile network... even worse, so it cannot work here. 但是智能手机的运行速度至少要慢20倍,而移动网络的运行速度至少要差20倍,因此无法在此处正常工作。 Moreover, your mobile users might not like also that their paid bandwidth is wasted. 此外,您的移动用户可能也不喜欢浪费他们的付费带宽。

If you need to provide your users a fast preview, you should build a few 'map' images that contains vignettes of all the images. 如果需要为用户提供快速预览,则​​应构建一些“地图”图像,其中包含所有图像的小插图。 I don't know of your development environment, but your tools have such feature, or you might find one on the web, or anyway you can quickly build your own 'vigneter' in phyton or like. 我不知道您的开发环境,但是您的工具具有这种功能,或者您可以在网上找到一个,或者无论如何,您都可以用phyton或类似工具快速构建自己的“渐晕器”。 I think that a clear naming convention (for files names+folder) is a must since 600-800 is becoming a large number. 我认为明确的命名约定(用于文件名和文件夹)是必须的,因为600-800越来越多。

The answer here is very simple. 答案很简单。 Computers are a LOT faster than phones, and have a lot more memory. 计算机比电话快很多,并且具有更多的内存。 Your website is apparently simply too resource intensive to run on a mobile phone. 您的网站显然太耗费资源,无法在手机上运行。

It's hard to point to the specific problem without seeing any code, but loading 5-600 images sounds fairly heavy. 没有看到任何代码就很难指出具体的问题,但是加载5-600张图像听起来相当繁重。 You will need to find ways to limit the resources you need to load at the same time. 您将需要找到方法来限制需要同时加载的资源。 And find ways to limit how much is shown to users on mobile phones. 并找到限制在手机上显示给用户的数量的方法。

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

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