So i am trying to create a parallax effect by targeting background-position with a data object.
<div class="parallaxBanner" :style="{scrollBanner}">
</div>
<script>
export default {
data: function(){
return{
scrollBanner: 0,
}
},
methods:{
scrollPosition: function(){
this.scrollbanner = window.scrollY % 0.5;
console.log(window.scrollY);
}
},
mounted() {
window.addEventListener('scroll', this.scrollPosition);
}
}
</script>
not 100% how to target css in line value any suggestions would be a big help :)