【发布时间】:2015-03-14 03:45:47
【问题描述】:
我一直在尝试进行响应式设计,但点击事件似乎锁定在 mozilla 上并且在其他浏览器上工作得很好我有以下代码
jQuery(document).ready(function($){
$("#serach-button").click(function() {
var display=$("#head-form").css("display");
if(display!="none"){
$("#head-form").fadeOut();
}else{
$(".menu").hide();
$("#head-form").show();
}
});
});
<div class="button-responsiv-list">
<button class="button-responsiv"><i id="serach-button"class="glyphicon glyphicon-search"></i></button>
<button class="button-responsiv"><i id="navbar-button" class="glyphicon glyphicon-align-justify"></i></button>
<button class="button-responsiv" ><i id="sidebar-button-show" class="glyphicon glyphicon-indent-right"></i>
<i id="sidebar-button-hide" style="display:none;" class="glyphicon glyphicon-indent-left"></i>
</button>
</div>
我尝试了 e.preventDeafualt() 但仍然无法正常工作。
【问题讨论】:
-
前段时间我也遇到过这种情况。在 e.preventDeafualt() 之后;添加返回假;或者只是返回false;而不是 preventDefault
-
我试过这个代码 e.preventDefault();返回假;但不工作
-
在您的标记中,
#head-form是哪里? -
#head-form 是一个 div 听例子link
-
该链接已损坏。您可以使用最少的标记更新问题中的标记。
标签: javascript jquery css firefox