UI template: HTML5 Banner, HTML5 Float
In the given example background, icons and font color change depending on weather conditions (parameters) at the moment of banner view: the time of day, season, weather elements, claudage. Weather widget and it’s content are optional.
HTML5 banner of any format using the real time meteo data through Weather API. Depending on a weather parameters a relevant banner from a .zip archive is shown on a page.
Meteo data:
- temperature (C, K, F),
- weather elements (rain, snow),
- cloudage,
- strength of wind,
- time to sunrise/sunset.
Download an archive with the template:
Download
How to work with .zip archive (template)
- Unpack an archive with a creative template.
- For creative preview use the Creatives Preview page
- Open the file body.html with the text editor and edit the code snippet inside tags <body> </body> (data entered outside these tags will not be saved).
- Edit JS files.
- Save all banner assets and create .zip archive. The file body.html must be in the root directory of the .zip file.
Adding weather module to HTML5 banner
Weather module can be added to any HTML5 banner.
Weather module should be listed as a function parameter while adding the globalHTML5Api:
- Adding a function module parameter code
globalHTML5Api.on('load', function(weather){
/*
YOUR CODE IS HERE
*/
})
Methods
Function
|
Arguments
|
Method |
Value
|
temperature(str){} |
str K=Kelvin, C=Celsius(default), F=Fahrenheit |
weather.temperature(str); |
temperature (by Celsius, Kelvin, Fahrenheit); default value is in Celsius |
rain(){} |
– |
weather.rain(); |
rain volume for the last 3 hours, mm
– for light rain (from 0 to 1 mm/h) returns 0.5
– for moderate rain (from 1 to 4 mm/h) returns 2.5
– for heavy intensity rain (from 4 to 16 mm/h) returns 10
– for very heavy rain (from 16 to 50 mm/h) returns 33
– for extreme rain (more than 50 mm/h) returns 50
– default value – 100 |
snow(){} |
– |
weather.snow(); |
snow volume for the last 3 hours, mm
– for light show (from 0 to 0.5 mm/h) returns 0.25
– for snow (from 0.5 to 5 mm/h) returns 2.75
– for heavy snow (more than 5 mm/h) returns 5
– default value – 10 |
clouds(){} |
– |
weather.clouds(); |
claudage, % |
wind(){} |
– |
weather.wind(); |
strength of wind, m/s |
timeToSunrise(){} |
– |
weather.timeToSunrise(); |
time to sunrise (within 24 hours),
{
'will' : { //time to sunrise
'h' : Number, //hh
'm' : Number, //mm
},
'was' :{//time after sunrise
'h' : Number, //hh
'm' : Number, //mm
},
}
|
timeToSunset(){} |
– |
weather.timeToSunset(); |
time to sunset (within 24 hours),
{
'will' : { //time to sunset
'h' : Number, //hh
'm' : Number, //mm
},
'was' :{//time after sunset
'h' : Number, //hh
'm' : Number, //mm
},
}
|
If banners change depending on some meteo data range, these range should cover all possible values.
Updated on October 07, 2024