Html 在手机上激活按钮?
当用户单击按钮时Html 在手机上激活按钮?,html,css,ruby,button,mobile,Html,Css,Ruby,Button,Mobile,当用户单击按钮时 #featured-challenge-button { background-color: #446CB3; box-shadow: 3px 3px 5px black; &:hover { background-color: #ccac00; box-shadow: none; } &:active { background-color: #ccac00; box-shadow: none; }
#featured-challenge-button {
background-color: #446CB3;
box-shadow: 3px 3px 5px black;
&:hover {
background-color: #ccac00;
box-shadow: none;
}
&:active {
background-color: #ccac00;
box-shadow: none;
}
&:focus {
background-color: #ccac00;
box-shadow: none;
}
}
按钮示例:
# link_to
<%= link_to next_challenge_path, class: "btn", id: "featured-challenge-button" do %>
<span class="glyphicon glyphicon-plus"></span>
<% end %>
# submit
<%= button_tag(type: 'submit', class: "btn", id: "featured-challenge-button") do %>
Save
<% end %>
#链接到
#提交
拯救
我如何显示它立即被按下
在浏览器上它可以工作,但在我的iPhone上,单击按钮时对按钮没有影响。点击按钮的唯一指示是屏幕顶部的加载条
我是否使用了
:active
错误,或者是否有其他CSS技术或javascript解决方案?您需要使用按钮上的ontouchstart
事件。简单使用
ontouchstart=“
在您的元素上,并且:active
将起作用
<button ontouchstart="">An Example</button>
一个例子
您需要使用按钮上的ontouch start
事件。简单使用
ontouchstart=“
在您的元素上,并且:active
将起作用
<button ontouchstart="">An Example</button>
一个例子
可能重复的how about:已访问的
可能重复的how about:已访问的
您知道我如何与ruby集成吗?更新问题。我现在正试图自己解决这个问题,但如果你知道的话,我会很感激:)@AnthonyGalli.com实际上你不需要将你的问题从html/js改为ruby。你必须提出一个新问题。Ruby呢,对不起,我不认识Ruby,你知道我如何与Ruby集成吗?更新问题。我现在正试图自己解决这个问题,但如果你知道的话,我会很感激:)@AnthonyGalli.com实际上你不需要将你的问题从html/js改为ruby。你必须提出一个新问题。鲁比呢,对不起,我不认识鲁比