Vue.config.productionTip = false;
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: {
slides: [1, 2, 3, 4, 5, 6, 7, 8],
},
methods: {
onIntersect(entries) {
const src = entries[0];
const target = src.target;
const isIntersecting = src.isIntersecting;
if (isIntersecting) {
target.classList.remove('bg--yellow');
target.classList.add('bg--blue');
} else {
target.classList.remove('bg--blue');
target.classList.add('bg--yellow');
}
}
},
})
.bg--blue {
background-color: blue !important;
}
.bg--yellow {
background-color: yellow !important;
}
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<div id="app">
<v-app>
<v-main>
<v-container>
<v-slide-group show-arrows>
<v-slide-item v-for="(slide, i) in slides" :key="i">
<v-card width="300" height="200" v-intersect="{
handler: onIntersect,
options: {
threshold: 1.0
}
}">
slide {{i}}
</v-card>
</v-slide-item>
</v-slide-group>
</v-container>
</v-main>
</v-app>
</div>