jQuery實現滑鼠經過時高亮,同時其他同級元素變暗的效果

來源:互聯網
上載者:User

標籤:效果   processor   relative   function   back   pos   src   add   min   

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>  <head>    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>    <meta name="keywords" content="關鍵詞1,關鍵詞2,關鍵詞3等等"/>    <title>滑鼠經過時高亮,其他的暗</title>    <style type="text/css">      *{margin:0; padding:0;}      ul,li{list-style:none;}      ul{width:900px; height:200px; margin:100px auto;}      li{width:200px; height:200px; display:inline-block; border:1px solid #d8d8d8; position:relative;}      .addblack{width:200px; height:200px; display:none; background:#000;filter: alpha(opacity=10);-moz-opacity: 0.1; opacity: 0.1; position:absolute; left:0; top:0;}    </style>    <script type="text/javascript" src="jquery-1.7.2.min.js"></script>    <script type="text/javascript">      $(document).ready(function(){         $(".index_Img").hover(function(){           $(this).siblings().find(".addblack").show();           },function(){             $(this).siblings().find(".addblack").hide();             $(this).find(".addblack").hide();         })      })    </script>  </head>  <body>    <ul>      <li class="index_Img">        蘋果        <div class="addblack" style="left: 0px; top: 0px; width: 200px; height: 200px; display: none;"></div>      </li>      <li class="index_Img">        香蕉        <div class="addblack" style="left: 0px; top: 0px; width: 200px; height: 200px; display: none;"></div>      </li>      <li class="index_Img">        葡萄        <div class="addblack" style="left: 0px; top: 0px; width: 200px; height: 200px; display: none;"></div>      </li>      <li class="index_Img">        鳳梨        <div class="addblack" style="left: 0px; top: 0px; width: 200px; height: 200px; display: none;"></div>      </li>    </ul>  </body></html>

jQuery實現滑鼠經過時高亮,同時其他同級元素變暗的效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.