js judges whether it is a mobile phone page

  • 2021-08-05 08:21:22
  • OfStack

Without saying much, please look at the code:


<script>
if (/mobile/i.test(navigator.userAgent) || /android/i.test(navigator.userAgent)) document.body.classList.add('mobile');
window.addEventListener('load', function(event) {
 setTimeout(function () {
  hab('#sup-post-2');
  hab('#gd1-inner');
 }, 1000);
});
</script>

Related articles: