In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "Vue.js how to achieve mouse suspension replacement picture function". In daily operation, I believe many people have doubts about how to achieve mouse suspension replacement picture function in Vue.js. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to achieve mouse suspension replacement picture function in Vue.js". Next, please follow the editor to study!
Effect:
First of all, overwrite all the selected pictures on the unselected pictures.
The html code is as follows
The css code is as follows
.right {float: left; ul {margin-left: 1px; li {display: inline-block; margin-left: 12px; width: 100px; height: 100px; a {position: relative; display: inline-block; width: 100px; height: 100px; .hide _ tab {position: absolute; bottom: 0;}}
In fact, it is very simple to layout through position:absolute, and now all the pictures with selected styles have been covered by images with no selected styles.
Then you need a variable to control their visibility. This variable should be an one-to-one corresponding to each category, so this variable should not be a simple Boolean value, but a number corresponding to each classified picture.
I define this variable as active, which is declared in data
Data () {return {active: 0}}
Define a method to control the change of the active variable
ShowActive (index) {this.active = index;}
The index parameter in the method is the value passed in when the mouse is hovering
Modify the html code as follows
Pictures with selected categories are displayed only if the current index and active are equal.
When the mouse leaves, pass in a 0 that does not correspond to it, so it is not displayed.
At this point, on the "Vue.js how to achieve mouse suspension replacement picture function" on the end of the study, I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.