$(function () {
window.addEventListener('message', function (event) {
switch (event.data.action) {
case 'toggle':
if (visable) {
$('#wrap').fadeOut();
} else {
$('#wrap').fadeIn();
window.health = event.data.health;
onloadAnimation(health);
}
visable = !visable;
break;
default:
break;
}
}, false);
});
progressBar.forEach(function(item) {
var self = item,
barValue = self.getAttribute('data-value'),
skillValue = self.getAttribute('data-skill'),
effectNum = self.getAttribute('data-effect');
if (skillValue == "Health") {
barValue = window.health; //The value wont set here but works on other function
}
})
window.health value can be set on other function but not this one , someone know how to solve this ? I just check it but its result undefined