Skip to content

✨ Add customizeable css classes #5 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ Is a compontent for fast 60fps parallax scroll effects in vue 2.
| fixed | Boolean | false | Other parallax effect. Image is fixed in position |
| sectionHeight | Number | 70 | section height for mobile |
| breakpoint | String | '(min-width: 968px)' | Media query for mobile deactivation |
| sectionClass | String | 'Masthead' | CSS class of the outer section tag |
| containerClass | String | 'Masthead__image' | CSS class of the container holding the image |
| parallaxClass | String | 'is-parallax' | Modifier class for the parallax effect |
| fixedClass | String | 'is-fixed' | Modifier class for the fixed parallax effect |

## Customizing

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.

## Build Setup

Expand Down
23 changes: 21 additions & 2 deletions src/components/Parallax.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<template>
<section class="Masthead" ref="block" v-bind:style="{ height: sectionHeight + 'vh' }">
<div class="Masthead__image" v-bind:class="{'is-parallax': parallax, 'is-fixed': fixed }" ref="parallax">
<section v-bind:class="[sectionClass]" ref="block" v-bind:style="{ height: sectionHeight + 'vh' }">
<div
v-bind:class="[parallax ? parallaxClass : '', fixed ? fixedClass : '', containerClass]"
ref="parallax"
>
<slot></slot>
</div>
</section>
Expand Down Expand Up @@ -29,6 +32,22 @@
default: 70,
type: Number,
required: false
},
sectionClass: {
type: String,
default: 'Masthead'
},
containerClass: {
type: String,
default: 'Masthead__image'
},
parallaxClass: {
type: String,
default: 'is-parallax'
},
fixedClass: {
type: String,
default: 'is-fixed'
}
},

Expand Down