E
E
Evgeny2018-02-09 14:33:36
JavaScript
Evgeny, 2018-02-09 14:33:36

How to set up scripts for the mobile version of the site?

Friends, hello everyone!
Tell me how best to build scripts for the site.
For desktop and tablet, there are animations that are not needed in a mobile phone. What I want to do. First, check the browser width, and then run the necessary scripts depending on the screen width. In my opinion, this is better than doing a width check inside each script and depending on the results, run or not.
And how do you solve this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Kotosin, 2018-02-09
Myagkikh @myagkikh_evgeniy

That's right, you check the condition if (width <= mobile phone) (function {insert scripts}); something like this, it's the most logical thing.

R
Roman, 2018-02-09
@RomanOracool

mobiledetect.net

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question