如果你想通过其宽度设置为你应该设置CSS属性overflow:hidden;
0完全隐藏元素及其内容。
section#step3
没有显示,因为#nextBtn
有href=""
,所以它是对当前文档的引用,只是点击刷新页面。你需要通过设置e.preventDefault();
$('#nextBtn').click(function(e){
e.preventDefault(); .....
至于#nextBtn
禁用,防止默认<a>
单击处理程序,只需添加一个类,并使用CSS3选择器:not()
并将它放在你的悬停状态#uiHome p a.button:not(.disabled):hover
。并非所有浏览器都支持此功能,但您也可以为.disabled
应用新的悬停状态样式,以便覆盖之前设置的悬停状态。
#uiHome p a.button.disabled {
opacity: .6;
filter: alpha(opacity=60);
}
#uiHome p a.button.disabled:hover {
color:#267BB6;
background:white ;
background-image:none ;
}
而不是blur()
我觉得这是更好地增加输入改变事件的处理程序禁用:
$('#uname').on('input propertychange', function() {
if ($(this).val() == "") {
$('#nextBtn').addClass("disabled");
}else {
$('#nextBtn').removeClass("disabled");
}
});
看到这个的jsfiddle:http://jsfiddle.net/R2RYs/2/
不错,按钮有残疾的属性。 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Attributes – isherwood
嗨isherwood,所以我应该用button标签替换标签? –