i can not understand why not show modal can help?
modal
<?php modal::begin([ 'header' => '<h2>accedi</h2>', 'id' => 'modalsmall', 'size' => 'modal-sm', //keeps closing modal esc key or clicking out of modal. // user must click cancel or x close 'clientoptions' => ['backdrop' => 'static', 'keyboard' => true], 'footer' => 'fdd' ]); echo "<div id='modalcontent'></div>"; modal::end(); ?>
js
$(function() { $('#modalbutton a').click(function(e) { e.preventdefault(); $('#modalsmall').modal('show') .find('.modal-content') .load($(this).attr('href')); }); });
what see
there not close button
<?php modal::begin([ 'header' => '', 'headeroptions' => ['id' => 'modalheader'], 'id' => 'modalsmall', 'size' => 'modal-medium', //medium 'clientoptions' => ['backdrop' => 'static', 'keyboard' => false] ]); echo "<div id='modalcontent'> <div class='col-lg'> <img src='".yii::$app->request->baseurl."/loading.gif' width='280' height='210' alt='loading...'> // put loading.gif in backend/web/ directory </div> </di>"; modal::end(); ?> $(function() { $('#modalbutton').click(function(e) { e.preventdefault(); $('#modalsmall').modal('show') .find('.modal-content') .load($(this).attr('value')); document.getelementbyid('modalheader').innerhtml = '<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button><h3>' + $(this).attr('title') + '</h3>'; }); });
how call?
use yii\helpers\url; <p> <?= html::a(yii::t('app', 'add something'), null, ['class' => 'btn btn-success', 'id'=>'modalbutton', 'value'=>url::to(['/controller/action']), 'title'=>'show in modal header' ]) ?> </p>
Comments
Post a Comment