Commit 1b06762d353879efe754d967d5f64454db0531f2
1 parent
5f694714
- events
- background in slider
Showing
4 changed files
with
11 additions
and
5 deletions
Show diff stats
common/models/event/Tag.php
| ... | ... | @@ -116,7 +116,7 @@ |
| 116 | 116 | /** |
| 117 | 117 | * @return \yii\db\ActiveQuery |
| 118 | 118 | */ |
| 119 | - public function getArticles() | |
| 119 | + public function getEvents() | |
| 120 | 120 | { |
| 121 | 121 | return $this->hasMany(Event::className(), [ 'id' => 'event_id' ]) |
| 122 | 122 | ->viaTable('event_to_tag', [ 'event_tag_id' => 'id' ]); | ... | ... |
frontend/controllers/EventController.php
frontend/views/site/index.php
| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | <!-- *** HOMEPAGE CAROUSEL *** |
| 17 | 17 | _________________________________________________________ --> |
| 18 | 18 | |
| 19 | - <div class="home-carousel"> | |
| 19 | + <div class="home-carousel" <?=$slides[0]->background !== null ? ' style="background: url('.$slides[0]->background->getUrl().') center center repeat;"' : ''?>> | |
| 20 | 20 | |
| 21 | 21 | <div class="dark-mask"></div> |
| 22 | 22 | |
| ... | ... | @@ -25,7 +25,7 @@ _________________________________________________________ --> |
| 25 | 25 | |
| 26 | 26 | <?php foreach ($slides as $key => $slide){?> |
| 27 | 27 | |
| 28 | - <div class="item"> | |
| 28 | + <div class="item" data-bg=<?=($slide->background !== null) ? $slide->background->getUrl() : ''?>> | |
| 29 | 29 | <div class="row"> |
| 30 | 30 | <div class="col-sm-5 <?=($key%2 == 0) ? 'right' : ''?>"> |
| 31 | 31 | <h1><?=$slide->title?></h1> | ... | ... |
frontend/web/js/front.js
| ... | ... | @@ -119,8 +119,14 @@ function sliders() { |
| 119 | 119 | //animationsSlider(); |
| 120 | 120 | console.log('init'); |
| 121 | 121 | }, |
| 122 | - afterMove: function () { | |
| 122 | + afterMove: function (elem) { | |
| 123 | 123 | //animationsSlider(); |
| 124 | + var bg = $(elem).children('.owl-wrapper-outer').children().find('.active').find('.item').data('bg'); | |
| 125 | + if (bg != ''){ | |
| 126 | + $(elem).parent().parent().css("background", 'url('+bg+') center center repeat'); | |
| 127 | + }else{ | |
| 128 | + $(elem).parent().parent().css('background', 'url(../img/photogrid.jpg) center center repeat'); | |
| 129 | + } | |
| 124 | 130 | console.log('move'); |
| 125 | 131 | } |
| 126 | 132 | }); | ... | ... |