[英]IE9 crashes after jquery click event
每当发生点击事件时,IE9崩溃都会出现一个奇怪的问题。 我以为这是克隆函数,可能是它的一个错误,因此尝试将其删除但存在相同的问题。 它适用于所有浏览器,甚至IE7和8,但9经常崩溃并且不确定。
<div class="icons">
<span class="attMessage"></span>
<span class="successMessage"></span>
<span class="errorMessage"></span>
</div>
<div class="newSection">
<h3>Add/Update Adjuster License</h3>
<p>(this is where i am appending an icon from above)</p>
<p><a title="Add license to queue" class="addLicense"></a></p>
</div>
_
$('.addLicense').click(function () {
var parent = $(this).parent();
var license = $('.licenseOverview');
var dropdown = $('#MainContent_ddlLicenseStates').val();
var number = $('#MainContent_txtLicenseNumber').val();
if (number != '') {
notifier(parent, "License Added To Queue", "Success");
$('#MainContent_txtLicenseNumber').val('');
}
else {
notifier(parent, "Must Enter A License Number", "Failure");
}
});
function notifier(oAppend, oMessage, oMessageType) {
var iconDiv = $('.icons');
if (oMessageType == 'Success') {
$('.icons > .successMessage').clone().html(oMessage).appendTo(oAppend).delay(100).fadeIn('slow').delay(500).fadeOut();
//tried a different way since i thought clone was crashing ie9
//$('.icons > .successMessage').html(oMessage).appendTo(oAppend).delay(100).fadeIn('slow').delay(500).fadeOut();
setTimeout(function () { oAppend.find('.successMessage').remove().appendTo(iconDiv); }, 2500);
}
else if (oMessageType == 'Failure') {
$('.icons > .errorMessage').clone().html(oMessage).appendTo(oAppend).delay(100).fadeIn('slow').delay(500).fadeOut();
setTimeout(function () { oAppend.find('.errorMessage').remove() }, 2500);
}
else if (oMessageType == 'Warning') {
$('.icons > .attMessage').clone().html(oMessage).appendTo(oAppend).delay(100).fadeIn('slow').delay(500).fadeOut();
setTimeout(function () { oAppend.find('.attMessage').remove() }, 2500);
}
}
好像是fadeIn()。delay(500).fadeOut()是罪魁祸首。 当淡出发生时,IE9便崩溃了。 我删除了fadeOut,没有发生崩溃。 我没有使用延迟,而是使用了超时功能来处理fadeOut,并且不再崩溃。
$('.icons > .successMessage').clone().html(oMessage).appendTo(oAppend).delay(100).fadeIn('slow');
setTimeout(function () { oAppend.find('.successMessage').fadeOut().remove(); }, 2500);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.