Skip to content

Commit 30c5655

Browse files
committed
Add back property
1 parent fb16626 commit 30c5655

File tree

6 files changed

+26
-4
lines changed

6 files changed

+26
-4
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,17 @@ myimageboxes:
123123
fit: cover
124124
```
125125

126-
#### 4.3. `mobile`
126+
#### 4.3. `back`
127+
128+
Defines the background behind transparent / contained images. Accepts any CSS-valid property for the `background` property. Default is `false`.
129+
130+
```yaml
131+
myimageboxes:
132+
type: imageboxes
133+
back: white # or '#fefefe', or 'rgb(255, 0, 255)', etc.
134+
```
135+
136+
#### 4.4. `mobile`
127137

128138
By default, images are not displayed when the panel switches to its mobile view. Not recommended, but if you want to override this, set the option to `true`.
129139

@@ -133,7 +143,7 @@ myimageboxes:
133143
mobile: false
134144
```
135145

136-
#### 4.4. `gap`
146+
#### 4.5. `gap`
137147

138148
![gap](https://user-images.githubusercontent.com/14079751/48333926-58bc1880-e659-11e8-8920-6ad913c63529.jpg)
139149

index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fields/imageboxes.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
'fit' => function($fit = 'cover') {
2020
return $fit;
2121
},
22+
'back' => function($back = false) {
23+
return $back;
24+
},
2225
'gap' => function($gap = false) {
2326
return $gap;
2427
},

src/components/field/ImageBoxes.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default {
1212
gap: Boolean,
1313
mobile: Boolean,
1414
ratio: Number,
15+
back: [Boolean, String]
1516
}
1617
};
1718
</script>

src/components/input/ImageBoxInput.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<figure :class="['k-checkbox-image-ctn', {'mobile-show': mobile}]">
44
<figure class="k-checkbox-image" :style="padding">
55
<img :src="image" :class="fit" alt="">
6-
<div class="background"></div>
6+
<div class="background" :style="background"></div>
77
</figure>
88
</figure>
99
<div>
@@ -32,6 +32,12 @@ export default {
3232
mobile: Boolean,
3333
padding: String,
3434
image: String,
35+
back: [Boolean, String]
3536
},
37+
computed: {
38+
background() {
39+
return this.back ? 'background:'+ this.back +';' : false
40+
},
41+
}
3642
}
3743
</script>

src/components/input/ImageBoxesInput.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:ratio="ratio"
1111
:mobile="mobile"
1212
:padding="padding"
13+
:back="back"
1314
@input="onInput(option.value, $event)"
1415
/>
1516
</li>
@@ -23,6 +24,7 @@ export default {
2324
fit: String,
2425
ratio: Number,
2526
mobile: Boolean,
27+
back: [Boolean, String],
2628
},
2729
computed: {
2830
padding() {

0 commit comments

Comments
 (0)