亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

懸停并單擊->更改顏色,再次單擊切換到原始ccolor

懸停并單擊->更改顏色,再次單擊切換到原始ccolor

揚帆大魚 2021-04-06 16:22:10
我有六個元素,當我將鼠標懸停在底部的三個按鈕中時,它們應該更改顏色。不僅當我將鼠標懸停在它們上時,而且當我單擊該按鈕時,這些元素的顏色都應保持不變,并且在下次單擊時,我希望它回到黑色。我成功地將元素懸停在按鈕上時會更改顏色,但是我無法使其在單擊時保持不變。并且在所有內容的頂部,將元素懸停在其自身的元素中(而不是通過底部的按鈕)時,元素將變為白色。這是我嘗試過的鏈接:https://jsfiddle.net/ge9bw5nm/4/$(document).ready(function() {  $(".colony_button").hover(    function() {      //mouse over      $(this).css('color', '#b8aa85');      $(".colony_element").css('fill', '#b8aa85');    },    function() {      //mouse out      $(".colony_element").css('fill', "#000000");      $(this).css('color', "#000000");    });  $(".prison_button").hover(    function() {      //mouse over      $(this).css('color', '#3268bf');      $(".prison_element").css('fill', '#3268bf');    },    function() {      //mouse out      $(this).css('color', "#000000");      $(".prison_element").css('fill', "#000000");    });  $(".open_button").hover(    function() {      //mouse over      $(this).css('color', '#e4cb3e');      $(".open_element").css('fill', '#e4cb3e');    },    function() {      //mouse out      $(this).css('color', "#000000");      $(".open_element").css('fill', "#000000");    });});.geomap {  top: 0;  width: 100%;  cursor: grab;}.timeline {  font-size: 2vw;  position: fixed;  bottom: 0;  left: 0;  background: rgba(204, 204, 204, 0.5);  padding: 1em 2em 1em 2em;  margin: 1em;  border-radius: 1.4em;  text-align: center;}.colonybutton,.prisonbutton,.openbutton {  width: 1em;  padding: 0.3em 4em 0 4em;  margin: 0;}.colony_button:hover,.prison_button:hover,.open_button:hover {  cursor: pointer;}.colony,.prison,.open {  display: inline-block;  /*margin-bottom: 1em;*/  padding: 0;}.colony_element,.open_element,.prison_element {  transition: 0.8s;}.colony_element:hover,.open_element:hover,.prison_element:hover {  fill: white ! important;  transition: 0.8s;  cursor: pointer;}
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 154 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號