Showing
1 changed file
with
6 additions
and
2 deletions
@@ -26,6 +26,7 @@ function intimacyData(data) { | @@ -26,6 +26,7 @@ function intimacyData(data) { | ||
26 | style = '', | 26 | style = '', |
27 | bgStyle = '', | 27 | bgStyle = '', |
28 | nowDate = new Date(), | 28 | nowDate = new Date(), |
29 | + myImage = new Image(), | ||
29 | nowYear = nowDate.getFullYear(), | 30 | nowYear = nowDate.getFullYear(), |
30 | nowMonth = nowDate.getMonth(), | 31 | nowMonth = nowDate.getMonth(), |
31 | nowDaysNub = calendar.calculateMonthDays(nowMonth, nowYear); | 32 | nowDaysNub = calendar.calculateMonthDays(nowMonth, nowYear); |
@@ -49,8 +50,11 @@ function intimacyData(data) { | @@ -49,8 +50,11 @@ function intimacyData(data) { | ||
49 | style = ''; | 50 | style = ''; |
50 | } | 51 | } |
51 | 52 | ||
52 | - if (data.fanCharts[i].img !== '') { | ||
53 | - bgStyle = 'background-image:url(' + data.fanCharts[i].img + ')'; | 53 | + if (data.fanCharts[i].img !== '' && data.fanCharts[i].img !== null) { |
54 | + myImage.src = data.fanCharts[i].img; | ||
55 | + myImage.onload = function() { | ||
56 | + bgStyle = 'background-image:url(' + data.fanCharts[i].img + ')'; | ||
57 | + }; | ||
54 | } else { | 58 | } else { |
55 | bgStyle = ''; | 59 | bgStyle = ''; |
56 | } | 60 | } |
-
Please register or login to post a comment