我有一個gridview,顯示已保存到mysql.I圖像的縮略圖,當它單擊時顯示爲彈出圖像。Yii2顯示圖像在彈出點擊圖片
的觀點,這是代碼[更新]
<?php
<div class="license-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
<?= Html::a('Create License', ['create'], ['class' => 'btn btn-success']) ?>
</p>
<?=
GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'pjax' => true,
'pjaxSettings' => [
'neverTimeout' => true,
'options' => [
'id' => '-pjax',
'enableReplaceState' => false,
'enablePushState' => false,
],
],
'columns' => [
['class' => 'yii\grid\SerialColumn',
'header' => 'No',
'options' => [
'width' => '10px',
],
],
'company',
'address',
[
'attribute' => 'bukti',
'value' => function ($data) {
return Html::a(Html::img(Yii::getAlias('@web') . '/file/' . $data->bukti, ['alt' => 'some', 'class' => 'fancy-box', 'height' => '100px', 'width' => '100px']), ['site/zoom']);
},
'format' => ['raw'],
],
['class' => 'yii\grid\ActionColumn'],
],
]);
?>
</div>
<?php
$this->registerJs('jQuery(document).ready(function(){
jQuery("a.fancy-box").fancybox();
});');
?>
我如何可以顯示圖像彈出時,它的點擊?
感謝
它沒有工作。這是給'圖像無法加載'。 – Blackjack
此消息出現在哪裏? –