W
W
web112014-09-14 23:20:44
PHP
web11, 2014-09-14 23:20:44

How to hide a module on a mobile device?

The site has a slideshow module.
The task is to hide this module when viewing the site from a smartphone.

The option of hiding using media queries is not suitable, because in this case, the pictures are still downloaded to the user's device, which slows down the overall page load.

Googled mobiledetect.net .
This solution for joomla, on which the site is developed, has a separate plugin .

It works, but only for mobile devices in general (phones+tablets).
The option to check only for phones does not work

if(MobileDetector::getPhoneDevices() === false){
...
}


I would be grateful if you tell me a working solution that you used in your projects.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
sinneren, 2014-09-15
@sinneren

The plugin says

// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
 
}
 
// Any tablet device.
if( $detect->isTablet() ){
 
}

so it works great for mobile and tablets separately

S
Sergey, 2014-09-15
Protko @Fesor

Why are tablets better than phones? Is a phone with a 7" screen a tablet or a phone? Is a tablet with a 10" screen and having a GSM module a tablet or a phone?

V
Viktor Vsk, 2014-09-15
@viktorvsk

MQ upload pictures?

D
Dima Pautov, 2014-09-15
@bootd

In our time, the phone is a loose concept. If I were you, I would track the width of the screen for this!
if($(window).width() == 200){
//Remove slider initialization etc.
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question