我刚尝试在一个页面中使用天气图标几次。 http://weathericons.char95.com/
但问题是画布中的ID:
<canvas id='icon1'></canvas>
<canvas id='icon'></canvas>
<canvas id='icon1'></canvas>
var icon1 = WeatherIcon.add('icon1', WeatherIcon.SUN, {mode:WeatherIcon.NIGHT, stroke:true, shadow:true, animated:true } );
我认为,问题在于“ID”。我必须使用“CLASS”。但我不知道如何更改代码。
答案 0 :(得分:0)
HTML / PHP / CSS没问题,但我不适合Javascrpit。
<script type='text/javascript' src='WeatherIcon.js'></script>
<canvas id='icon1'></canvas>
<canvas id='icon2'></canvas>
<canvas id='icon3'></canvas>
<script type='text/javascript'>
WeatherIcon.add('icon1' , WeatherIcon.SUN , { mode:WeatherIcon.DAY , stroke:true , shadow:true , animated:true } );
WeatherIcon.add('icon2' , WeatherIcon.LIGHTRAINSUN , { mode:WeatherIcon.NIGHT , stroke:true , shadow:true , animated:true } );
WeatherIcon.add('icon3' , WeatherIcon.LIGHTRAINTHUNDERSUN ); // no parameters