Here is the problem, unfortunately we have to support IE8.
So I had to change from using the latest jQuery 2.0+ back to jQuery 1.9.
Now we use a lot of jQuery to load up different sections of our dashboard, we fadeOut
previous screens and fadeIn
new screens. I thought I had fixed all of these problems with solutions I found here(prepend html) and here(ajax HTML).
However still having one more problem with the same error message below:
Error:
Uncaught TypeError: Cannot set property 'cur' of undefined
I've narrowed down the source to the loadResource function, which is used to switch out content.
Basically if I comment out this line from the function below:
$content.fadeIn('fast');
And replace it with
$content.show();
The problem is solved and we no longer get that 'cur' error. However we lose our fadeIn effect.
How would you approach this problem that solves the Uncaught TypeError
in jQuery 1.9 while keeping our fadeIn
effect on $content
?
var loadResource = function(url, params, callback) {
WHOAT.networking.getToServerWithAjax(url, params, function (response) {
var $content = $($.parseHTML(response.trim()));
var $container = $('#dashboard-display');
var $content_to_hide = $container.children();
$.when($content_to_hide.fadeOut('fast')).then(function () {
$content.hide();
$container.append($content);
//$content.fadeIn('fast'); // <- buggy in 1.9.1
$content.show(); // <- works, but no fadeIn
$content_to_hide.remove();
if(callback) {
callback();
}
});
});
// CSS updates...
};
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…