Skip to content

Commit 0d5f89c

Browse files
authored
Merge pull request #6 from apertureless/feature/#5_custom_classes
✨ Add customizeable css classes #5
2 parents c0c8d5c + f51f272 commit 0d5f89c

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ Is a compontent for fast 60fps parallax scroll effects in vue 2.
4545
| fixed | Boolean | false | Other parallax effect. Image is fixed in position |
4646
| sectionHeight | Number | 70 | section height for mobile |
4747
| breakpoint | String | '(min-width: 968px)' | Media query for mobile deactivation |
48+
| sectionClass | String | 'Masthead' | CSS class of the outer section tag |
49+
| containerClass | String | 'Masthead__image' | CSS class of the container holding the image |
50+
| parallaxClass | String | 'is-parallax' | Modifier class for the parallax effect |
51+
| fixedClass | String | 'is-fixed' | Modifier class for the fixed parallax effect |
4852

53+
## Customizing
54+
55+
You can change some of the behavior by changing the css classes. To be more clean, you can change them over the props. No need to overwrite or `!important` the existing classes.
4956

5057
## Build Setup
5158

src/components/Parallax.vue

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<template>
2-
<section class="Masthead" ref="block" v-bind:style="{ height: sectionHeight + 'vh' }">
3-
<div class="Masthead__image" v-bind:class="{'is-parallax': parallax, 'is-fixed': fixed }" ref="parallax">
2+
<section v-bind:class="[sectionClass]" ref="block" v-bind:style="{ height: sectionHeight + 'vh' }">
3+
<div
4+
v-bind:class="[parallax ? parallaxClass : '', fixed ? fixedClass : '', containerClass]"
5+
ref="parallax"
6+
>
47
<slot></slot>
58
</div>
69
</section>
@@ -29,6 +32,22 @@
2932
default: 70,
3033
type: Number,
3134
required: false
35+
},
36+
sectionClass: {
37+
type: String,
38+
default: 'Masthead'
39+
},
40+
containerClass: {
41+
type: String,
42+
default: 'Masthead__image'
43+
},
44+
parallaxClass: {
45+
type: String,
46+
default: 'is-parallax'
47+
},
48+
fixedClass: {
49+
type: String,
50+
default: 'is-fixed'
3251
}
3352
},
3453

0 commit comments

Comments
 (0)