As title said, How to add a script on mobile version only?
How can i do it?
For some javascript effect, i only want it appear on mobile version.
Can any body know how to set up?
Thank you !
As title said, How to add a script on mobile version only?
How can i do it?
For some javascript effect, i only want it appear on mobile version.
Can any body know how to set up?
Thank you !
Hi @Elvis_Liou,
You are going to have to write your scripts to “target” window sizes below 600px which is the current break-point for the mobile view.
I would use media detection in:
$( document ).ready(function() {
var isMobile = window.matchMedia("only screen and (max-width: 760px)");
if (isMobile.matches) {
//Conditional script here
}
});
There’s a great thread here.
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.