<?php
if($flashes = Yii::app()->user->getFlashes()) {
foreach($flashes as $key => $message) {
if($key != 'counters') {
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>$key,
'options'=>array(
'show' => 'blind',
'hide' => 'explode',
'modal' => 'true',
'title' => $message['title'],
'autoOpen'=>true,
'dialogClass'=>$message['type'],
'buttons'=>array('Закрыть'=>'js:function() {$(this).dialog("close");}'),
'close'=>'js:function(e,ui){
$(this).dialog("destroy").remove();
}',
),
'htmlOptions'=>array(
'class'=>'flash-success',
),
));
printf('<span class="dialog">%s</span>', $message['content']);
$this->endWidget('zii.widgets.jui.CJuiDialog');
}
}
}
Page 1 of 1
How To Autoclose Or Destroy Cjuidiaсог After 5 Seconds?
#1
Posted 19 December 2012 - 06:39 AM
I have dialog for flash messages. But now the user must click close or escape button. I want to destroy dialog after 5 seconds, but only form inside this dialog destroys (( May be use something else instead of CJuiDialog ? Help please.
#2
Posted 19 December 2012 - 08:06 AM
updated code
Bsourcecode
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'dialogbox',
// additional javascript options for the dialog plugin
'options'=>array(
'title'=>'Dialog box 1',
'autoOpen'=>true,
'open' => 'js:function(event, ui) {
setTimeout(function() {
$("#dialogbox").dialog("close");
}, 5000);
}',
),
));
Bsourcecode
#3
Posted 19 December 2012 - 08:23 AM
mbala, on 19 December 2012 - 08:06 AM, said:
updated code
Bsourcecode
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
'id'=>'dialogbox',
// additional javascript options for the dialog plugin
'options'=>array(
'title'=>'Dialog box 1',
'autoOpen'=>true,
'open' => 'js:function(event, ui) {
setTimeout(function() {
$("#dialogbox").dialog("close");
}, 5000);
}',
),
));
Bsourcecode
YES!!!! It's great! Thank you very much, mbala!
Share this topic:
Page 1 of 1

Help












