UPGRADE YOUR BUISENESS !! 中小企業のためのクラウドコンピューティング。ビジネスのためのWEBアプリやCMS、APIを紹介するブログです。
jQuery Countdown プラグインを使っている時に
残り1時間未満のときに「あと0時間」と表示しない方法はないかな、
と調べたらドキュメントに載っていたので、忘れないようにメモです。
以下のように記述することで対応できました。
$('#foo').countdown({
until: (終了時刻の Date オブジェクト),
layout: 'あと {d<}{dn} 日 と {d>}{h<}{hn} 時間 {h>}{m<}{mnn} 分 {m>}{snn} 秒',
format: 'dhms'
});
layoutプロパティで、0日のときに表示したくない部分を{d<}と{d>}で囲って、
formatプロパティに'dhms'を指定するとOKでした。
(※formatプロパティのデフォルトはdHMS)
http://keith-wood.name/countdownRef.html
layoutの項目に
If you need to exclude entire sections when the period value is zero and you have specified the period as optional, surround these sections with '{p<}' and '{p>}', where p is the same as above.との記述がありました。
●カテゴリ
●メニュー