我正在创建一个文件拖放效果,当拖动文件时,边框颜色应该会改变。
#upload-photo {
height: 150px;
text-align: center;
line-height: 150px;
font-size: 18px;
border-radius: 3px 3px 3px 3px;
border-style: dashed;
border:4px dashed #c0c0c0;
}
.upload-photo-border {
border:4px solid #999;
}
HTML 代码:
<div id="upload-photo">Drop photo here to upload.</div>
jQuery 代码
.............
dragOver: function() {
// user dragging files over #dropzone
$("#upload-photo").addClass("upload-photo-border");
$('#upload-photo').css('width', '100px');
},
..........
添加所需的类后,边框颜色仍然不会改变。不确定我是否做错了什么。