I'm looking to update the icon of a specific element on hover using Vue instead of JS/jQuery. Currently, my code is changing the icons of all four elements when hovered over:
HTML:
<div class="col-md-3">
<div class="welcome-latest">
<div class="hover-icon animated" v-bind:class="{ latestActive : isActive }">
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div class="welcome-latest-part"
v-on:mouseover="latestActive"
v-on:mouseleave="latestInActive">
<a href="#">
<div class="latest-icon">
<i class="fa fa-play-circle-o" aria-hidden="true"></i>
</div>
<hr>
<div class="latest-title">
<h2>Lorem ipsum dolor sit amet, consectetur adipisicing elit</h2>
</div>
</a>
</div>
</div>
</div>
Vue:
new Vue({
el: '#app',
data : {
isActive : true
},
methods : {
latestActive (part) {
this.isActive = false;
},
latestInActive(part) {
this.isActive = true;
}
}
});
However, I want to only change the icon of the hovered element. Any suggestions on how to achieve this? Thank you in advance.
This is my fiddle!