当前位置: 首页 > article >正文

(css)鼠标移入或点击改变背景图片

(css)鼠标移入或点击改变背景图片


在这里插入图片描述


html

<div class="mapTip">
  <div
    v-for="(item, index) of legendList"
    :key="index"
    class="mapTipOne"
    :class="{ active: change === index }"
    @click="legendHandle(item, index)"
  >
    {{ item }}
  </div>
</div>

js

data() {
   return { 
     ...
     change: null,
   };
 },
methods: { 
	// 点击方法
	legendHandle(item, index) {
	  this.change = index;
	},
}

style

// 图例
.mapTip {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 14px;
  .mapTipOne {
    width: 150px;
    height: 30px;
    background: url("@/assets/images/home-image/mian-right-middle-list-bg0.png")
      no-repeat;
    background-position: 0px 0px;
    background-size: 100% 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 6px;
    cursor: pointer;
  }
  .active,
  .mapTipOne:hover {
    background: url("@/assets/images/home-image/mian-right-middle-list-bg1.png")
      no-repeat;
    background-position: 0px 0px;
    background-size: 100% 100%;
  }
}

http://www.kler.cn/a/448839.html

相关文章:

  • windows 下使用WLS2 编译aosp Android14并刷机到pixle 5a
  • 鱼跃医疗获评2024年国家级“绿色工厂”,以绿色制造树立行业标杆
  • 《 火星人 》
  • 基础爬虫案例实战
  • 【Threejs】从零开始(六)--GUI调试开发3D效果
  • C05S13-MySQL数据库备份与恢复
  • 运用软件开发的三层结构创建图书馆查书
  • STM32-KEIL5中相关设置
  • vue 文本域 展示的内容格式要和填写时保持一致
  • 「Mac畅玩鸿蒙与硬件47」UI互动应用篇24 - 虚拟音乐控制台
  • ctf中遇到exec和shell_exec的回显问题
  • 基于SpringBoot的“家具销售电商平台”的设计与实现(源码+数据库+文档+PPT)
  • Stream流的使用
  • 【Python 】循环
  • matplotlib中文字体 graphviz中文字体
  • 基于WCF(C#)+SQL SERVER设计与实现的在线评测系统
  • 前端获取excel表格数据并在浏览器展示
  • Java设计模式 —— 【结构型模式】桥接模式详解
  • linux下蓝牙调试工具hcitool的使用
  • 【git】开发中分支使用原则与流程