按钮不适用于移动设备,但适用于 PC 引导程序 [英] Button not working on Mobile Devices but works on PC bootstrap

查看:30
本文介绍了按钮不适用于移动设备,但适用于 PC 引导程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个内部有链接的引导按钮.看起来像这样:

I created a bootstrap button that has a link inside. Which looks like this:

当你悬停在它上面时:

这是按钮内的代码:

 <div class="s-8"><button type="button" onClick="javascript:location.href = 'administration.php';">Administration</button></div>

退出按钮:

<div class="s-4"><button type="button" onClick="javascript:location.href = 'logout.php';">Logout</button></div>

此按钮在 PC(IE、SAFARI、FireFox、Chrome、Opera)浏览器上工作正常(将我带到管理页面,但在移动设备上不起作用.

This button works fine on the PC(IE, SAFARI, FireFox, Chrome, Opera) browser(takes me to the administration page, but it doesn't work on the Mobile devices.

我对注销按钮做了同样的事情,它在 PC 和移动设备上运行良好.我现在很困惑.

I did the same thing for the logout button, and it works fine on PC and Mobile Devices. I am now puzzled.

推荐答案

问题可能是您使用的 onClick 事件不会在移动设备上注册(因为您没有点击 - 您点击).

The issue may be that you're using the onClick event which won't register on a mobile device (as you don't click - you tap).

此答案解释了如何使用可在移动设备上运行的touchstart"事件.

This answer explains how to use the "touchstart" event which will work on a mobile.

https://stackoverflow.com/a/22015946/2619909

这篇关于按钮不适用于移动设备,但适用于 PC 引导程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆