Skip some code if the computer is slow

后端 未结 6 1026
旧时难觅i
旧时难觅i 2021-02-04 09:27

Is there any way to detect if a computer is slow and not run some code (by either turning jQuery animations off or just running a function if it is fast)?

I kno

6条回答
  •  南旧
    南旧 (楼主)
    2021-02-04 09:31

    i think there are two options:

    1. Let the user decide - give a 'low bandwidth/low spec' option to the user which when clicked will display the simpler version of the site.

    2. Try to detect slow machines - you could try to detect a slow machine by using a timeout script - if the animation/loading doesn't complete within a certain time switch to the simpler version of the site. The downside to this method is that you have no idea why the script timed out - perhaps it was a bad connection or the user was loading something else at the same time temporarily slowing their machine.

    Hope this gives you some ideas.

    Josh

提交回复
热议问题