如何从移动版本中删除滑块而不是隐藏它?

问题描述 投票:0回答:1

我正在尝试从移动设备上的网站中删除滑块。我知道我可以使用display:none样式,但这只隐藏了导致浏览器尝试加载它的元素,因此减少了加载时间。无论如何,我可以使用PHP或jquery完全删除移动设备上的网站? TIA。

php jquery html mobile responsive
1个回答
0
投票

有几种方法可以做到这一点。您可以使用PHP并检查访问者是否使用移动设备。我建议你使用这个库:Mobile_Detect.php

并使用它:

require_once 'Mobile_Detect.php';
$detect = new Mobile_Detect;
// Any mobile device (phones or tablets).
if ($detect->isMobile() ) {
  //do something
}

这里的一切:http://mobiledetect.net/

在替代方案中,您可以将$ _SERVER ['HTTP_USER_AGENT']与preg_match一起使用。

© www.soinside.com 2019 - 2024. All rights reserved.