twitter-bootstrap - 为什么我的移动设备上的 Bootstrap 按钮不起作用?
问题描述
我的网站上有按钮,可以在桌面上工作,但不能在移动设备上工作。
<button type="button" class="btn btn-primary rounded-0"><a href="
https://google.com">Google</a></button>
我知道在移动设备上我点击而不点击。但是如果可能的话,我怎样才能在没有js的情况下触发水龙头呢?
解决方案
不要在按钮中使用锚标记。对按钮使用 onClick。或者,您可以将锚设置为按钮:
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<button type="button" onclick="window.location='https://google.com'" class="btn btn-primary rounded-0">Google</button>
<a class="btn btn-primary rounded-0" href="https://google.com">Google</a>
推荐阅读
- android - 如何从片段更改主要活动底部导航中的徽章编号?
- azure-devops - ##[error]ENOENT: no such file or directory, chmod '' in azure devops kubernetes task
- maven - Azure Artifacts - 下载 Maven 包内容会引发 azure UnhandledPromiserejectionWarning
- android - 如何在自己的应用程序中使用 3rd 方 TvProvider 对象?
- swagger - 如何对 Swagger 模型进行版本化?
- python - 用每个字典的唯一键展平嵌套字典?
- regex - 正则表达式查找特定模式
- python - 如何将 Mlib 库添加到 Spark?
- orientdb - Orientdb SELECT 和带有聚合的子查询
- if-statement - if 语句条件嵌入列中