Blame view

frontend/modules/map/views/item/vparts/gallery.php 1.54 KB
d1f8bd40   Alexey Boroda   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
  <?php
  
  use yii\helpers\Html;
  use frontend\components\ImageResizer;
  
  /**
   *
   * @author FilamentV <vortex.filament@gmail.com>
   * @copyright (c), Thread
   *
   * @var $model \frontend\modules\map\models\Item
   */
  $gallery = $model->getGalleryItemsPath();
  ?>
      <div class="tab-pane fade" id="galery" style="height: 600px;">
      </div>
      <div class="gallery_slide_block" style="position: absolute; left: -10000px; top: 70px;">
          <ul class="bxslider">
              <?php
              foreach ($gallery as $img) {
                  echo Html::beginTag('li')
                      . Html::img(ImageResizer::getThumb($img['image_path'], 600, 400), [
                          'alt' => ($img['title']) ? $img['title'] : $model['lang']['title']
                      ])
                      . Html::tag('p', $img['title'], [
                              'class' => 'gallery_title'
                      ])
                      . Html::endTag('li');
              }
              ?>
          </ul>
      </div>
  <?php
  $this->registerJs("
      $(document).ready(function () {
          $('.bxslider').bxSlider({
              auto: true,
              infiniteLoop: true,
              autoControls: true,
              stopAutoOnClick: true,
              pager: true,
              slideWidth: 600
          });
  
          $('.nav-tabs li').on('click', function () {
              if ($(this).find('a').attr('href') == '#galery') {
                  $('.gallery_slide_block').css('left', \"40px\");
              } else {
                  $('.gallery_slide_block').css('left', \"-10000px\");
              }
          });
      });
  ");