Disable JavaScript function based on the user's computer's performance

后端 未结 3 1360
天涯浪人
天涯浪人 2021-01-01 20:40

My website has a jQuery script (from Shadow animation jQuery plugin) which constantly changes the colour of box shadow of various

s on the h
3条回答
  •  Happy的楠姐
    2021-01-01 21:23

    You could probably do it by timing a few times round a loop which did some intensive processing on page load, but that's going to slow the page and add even further to CPU load, so it doesn't seem like a great solution.

    A compromise I've used in the past, though, was to make the decision based on browser version, for example, Internet Explorer 6 users get simpler content whereas newer browsers with better JavaScript performance get the animation. That seemed to work pretty well at a practical level. In practice, browser choice is a big factor in JavaScript performance and you might get a 90% fit with what you want very simply just by taking that into account.

提交回复
热议问题