sac*_*rma 4 html javascript css web
我已经使用 HTML、CSS、JS (Paper.js) 创建了一个网页,但我希望我的网页仅在桌面站点中打开时显示,如果它在任何智能手机中打开,消息必须显示为在桌面中打开,没有其他必须已加载,因为在触摸屏设备中,所有功能都无法正常工作
链接到我的网页是 -
https://sachinverma53121.github.io/Keypress-Sounds/key-sounds.html
如果页面小于一定宽度,您可以使用 JS 不显示 div/tag
像这样的事情可能会做:
<p id="demo">This only shows when the window is more than 500.</p>
<p id="message" style="display: none;">Please use this on a desktop.</p>
<script>
if (window.innerWidth < 500){
document.getElementById("demo").style.display = "none";
document.getElementById("message").style.display = "block";
}
</script>
Run Code Online (Sandbox Code Playgroud)
你也可以使用 CSS
<style>
#message {
display: none;
}
@media (max-width: 500px){
#demo {
display: none;
}
#message {
display: block;
}
}
</style>
<p id="demo">This only shows when the window is more than 500.</p>
<p id="message">Please use this on a desktop.</p>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1482 次 |
| 最近记录: |