在我的应用程序中,我已经实现了拖放上传。当您在"拖放区域"上拖动并按住图像时,拖放区域的外观会发生变化,并且会显示一条文本告诉您拖放文件。
如果我取消删除文件,新的 CSS 和文本仍然存在,我需要刷新页面才能使其恢复正常。如何在不刷新页面的情况下将 css 重置为正常状态?
提前感谢!
holder.ondragover = function () {
var information = "<div id='infoText2'>" + "<span>Drop the image here!</span>";
$('#holder').html(information);
this.className = 'hover';
return false;
};
// Rest of the code
您可以尝试删除div 并在收到 ondragend
事件时删除类名
holder.ondragend = function () {
$('#intoText2').remove();
this.removeClass();
};