Retry calculate add size if is not working
This commit is contained in:
1 parent
8fcd34759f
commit
239bff06ce
3 files changed
+21
-7
No files matched your search
+10
-3
@@ -1,7 +1,14 @@
|
||||
function calculateSize(targetId) {
|
||||
function calculateSize(targetId, tries) {
|
||||
if (tries == undefined) {
|
||||
tries = 0;
|
||||
}
|
||||
setTimeout(function(){
|
||||
$('#' + targetId).height($('#' + targetId).children(":first").height());
|
||||
$('#' + targetId).width($('#' + targetId).children(":first").width());
|
||||
if (($('#' + targetId).children(":first").height() == 0 || $('#' + targetId).children(":first").width() == 0) && tries < 4) {
|
||||
calculateSize(targetId, tries + 1);
|
||||
} else {
|
||||
$('#' + targetId).height($('#' + targetId).children(":first").height());
|
||||
$('#' + targetId).width($('#' + targetId).children(":first").width());
|
||||
}
|
||||
}, 500);
|
||||
$('#' + targetId).css({backgroundColor: 'transparent'});
|
||||
}
|
||||
Reference in new issue
Block a user