Retry calculate add size if is not working
This commit is contained in:
13
resources/assets/js/functions/advertisement.js
vendored
13
resources/assets/js/functions/advertisement.js
vendored
@@ -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