jQuery loads the corresponding style depending on whether the user's computer is mac or pc

  • 2020-06-22 23:49:06
  • OfStack

This example shows how jQuery loads the corresponding style depending on whether the user's computer is mac or pc. Share to everybody for everybody reference. Specific implementation methods are as follows:


if (navigator.userAgent.indexOf('Mac OS X') != -1) {
 $("body").addClass("mac");
} else {
 $("body").addClass("pc");
}

Hopefully, this article has been helpful in your jQuery programming.


Related articles: