Last Updated: February 25, 2016
·
753
· codesbyaxel

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 >>   

}