fix: 屏幕宽度确定pc/mobile模板问题

This commit is contained in:
2025-06-20 11:29:41 +08:00
parent 1fec0dcc42
commit ed02804587
2 changed files with 8 additions and 1 deletions

View File

@@ -7,7 +7,7 @@ use Detection\MobileDetect;
$detect = new MobileDetect(); $detect = new MobileDetect();
$view_device_name = 'pc'; $view_device_name = 'pc';
if ($detect->isMobile() || $detect->isTablet()) { if ($detect->isMobile() || $detect->isTablet() || request()->get('mtpl') == 1) {
$view_device_name = 'mobile'; $view_device_name = 'mobile';
} }

View File

@@ -18,6 +18,13 @@
<script type="text/javascript" src="https://unpkg.com/swiper@9.4.1/swiper-bundle.min.js"></script> <script type="text/javascript" src="https://unpkg.com/swiper@9.4.1/swiper-bundle.min.js"></script>
<script type="text/javascript" src="__JS__/before-after.min.js"></script> <script type="text/javascript" src="__JS__/before-after.min.js"></script>
<script type="text/javascript" src="__JS__/large.js"></script> <script type="text/javascript" src="__JS__/large.js"></script>
<script type="text/javascript">
$(window).ready(function() {
if ($(window).width() < 1024) {
window.location.href = '?mtpl=1';
}
})
</script>
</head> </head>
<body> <body>
{block name="header"} {block name="header"}