Installation
download
Download latest version, (*1)
composer
add this line to your composer.json
"russ666/yii2-countdown": "*"
, (*2)
Usage
echo \russ666\widgets\Countdown::widget([
'id' => 'some-id',
'datetime' => date('Y-m-d H:i:s O', time() + 1000),
'format' => '\<span style=\"background: red\"\>%M</span>:%S',
'tagName' => 'span',
'events' => [
'finish' => 'function(){location.reload()}',
],
])
Params
id
Container id., (*3)
datetime
Datetime string to countdown. Must be added with timezone, to prevent client-server timezone difference issue., (*4)
Datetime format for widget (http://hilios.github.io/jQuery.countdown/documentation.html#formatter), (*5)
events
Widget events (http://hilios.github.io/jQuery.countdown/documentation.html#events), (*6)
options
Container html options., (*7)
tagName
Container tag name., (*8)
Plugin pages
Homepage - http://hilios.github.io/jQuery.countdown, (*9)
GitHub - https://github.com/hilios/jQuery.countdown, (*10)