選項卡的製作和注意要點,選項卡製作要點

來源:互聯網
上載者:User

選項卡的製作和注意要點,選項卡製作要點

說到選項卡,一開始我還真有點搞不懂怎麼弄出來的,但一想其實也比複雜啊,無非就是把事件和事件的範圍給控制好就行了。

第一事件:事件就兩個,滑鼠放上去還有滑鼠離開,即放上顯示,離開隱藏。

第二事件的範圍: 這是關鍵的所在吧,因為當你發現吧 控制好了以後有一個大的問題就是當滑鼠離開選項卡選項的時候往下移動,則會出現選項卡消失。

所以,應該把事件的範圍控制的大一些,即把整個選項卡還有內容包括起來。

下面是具體的作業碼。

01.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>選項卡</title><link rel="stylesheet" type="text/css" href="./file/01.css"><script type="text/javascript" src="./file/jquery.js"></script><script type="text/javascript" src="./file/01.js"></script></head><body><div class="div_1" id="div_1"><div class="div_1_1">選項卡1</div><div class="div_1_1_1" id="div_1_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_2" id="div_2"><div class="div_2_1">選項卡2</div><div class="div_2_1_1" id="div_2_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_3" id="div_3"><div class="div_3_1">選項卡3</div><div class="div_3_1_1" id="div_3_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_4" id="div_4"><div class="div_4_1">選項卡3</div><div class="div_4_1_1" id="div_4_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_5" id="div_5"><div class="div_5_1">選項卡3</div><div class="div_5_1_1" id="div_5_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_6" id="div_6"><div class="div_6_1">選項卡3</div><div class="div_6_1_1" id="div_6_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_7" id="div_7"><div class="div_7_1">選項卡3</div><div class="div_7_1_1" id="div_7_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div><div class="div_8" id="div_8"><div class="div_8_1">選項卡3</div><div class="div_8_1_1" id="div_8_1_1"><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/><a href="#">111111111</a><br/></div></div></body></html>
01.css

body{background-color: #646464;}*{margin: 0px;padding: 0px;}.div_1{margin-left: 200px;width: 100px;height: 300px;float: left;}.div_2,.div_3,.div_4,.div_5,.div_6,.div_7,.div_8{margin-left: 20px;width: 100px;height: 300px;float: left;}.div_1_1,.div_2_1,.div_3_1,.div_4_1,.div_5_1,.div_6_1,.div_7_1,.div_8_1{background-color: black;width: 100px;height: 40px;color: white;}.div_1_1_1,.div_2_1_1,.div_3_1_1,.div_4_1_1,.div_5_1_1,.div_6_1_1,.div_7_1_1,.div_8_1_1{background-color: orange;width: 100px;height: 260px;display: none;}
01.js:

$(document).ready(function(){$("#div_1").mouseover(function(){$("#div_1_1_1").css("display","block");});$("#div_1").mouseout(function(){$("#div_1_1_1").css("display","none");});$("#div_2").mouseover(function(){$("#div_2_1_1").css("display","block");});$("#div_2").mouseout(function(){$("#div_2_1_1").css("display","none");});$("#div_3").mouseover(function(){$("#div_3_1_1").css("display","block");});$("#div_3").mouseout(function(){$("#div_3_1_1").css("display","none");});$("#div_4").mouseover(function(){$("#div_4_1_1").css("display","block");});$("#div_4").mouseout(function(){$("#div_4_1_1").css("display","none");});$("#div_5").mouseover(function(){$("#div_5_1_1").css("display","block");});$("#div_5").mouseout(function(){$("#div_5_1_1").css("display","none");});$("#div_6").mouseover(function(){$("#div_6_1_1").css("display","block");});$("#div_6").mouseout(function(){$("#div_6_1_1").css("display","none");});$("#div_7").mouseover(function(){$("#div_7_1_1").css("display","block");});$("#div_7").mouseout(function(){$("#div_7_1_1").css("display","none");});$("#div_8").mouseover(function(){$("#div_8_1_1").css("display","block");});$("#div_8").mouseout(function(){$("#div_8_1_1").css("display","none");});});




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.