Answer the question
In order to leave comments, you need to log in
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){
...
}
Answer the question
In order to leave comments, you need to log in
The plugin says
// Any mobile device (phones or tablets).
if ( $detect->isMobile() ) {
}
// Any tablet device.
if( $detect->isTablet() ){
}
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?
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 questionAsk a Question
731 491 924 answers to any question