Custom JS for mobile
Ever wanted to use a specific JS for the mobile version of your website? These simple, but powerful, lines of JS tells devices with a screen width less than 540px to use your specific mobile JS. The width can be customized, off course.
/*! Custom mobile JS */
if (document.documentElement.clientWidth < 540) {
<< your mobile JS here >>
}Written by Axel Ferdinand Giæver
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#