溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

jQuery實(shí)現(xiàn)鼠標(biāo)懸停3d菜單展開(kāi)動(dòng)畫效果

發(fā)布時(shí)間:2020-08-20 14:32:32 來(lái)源:腳本之家 閱讀:146 作者:roucheng 欄目:web開(kāi)發(fā)

豎直的主菜單貼著頁(yè)面左側(cè),當(dāng)光標(biāo)移入菜單項(xiàng)時(shí),以3D動(dòng)畫的方式彈出對(duì)應(yīng)的二級(jí)菜單。

采用jQuery和CSS3實(shí)現(xiàn)。支持Chrome,火狐,Edge等瀏覽器。

效果圖:

jQuery實(shí)現(xiàn)鼠標(biāo)懸停3d菜單展開(kāi)動(dòng)畫效果

代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
<title>jQuery鼠標(biāo)懸停3d菜單展開(kāi)動(dòng)畫 - 何問(wèn)起</title><base target="_blank" />
<link rel="stylesheet" type="text/css" >
</head>
<body>
<div class="wrap">
 <div class="logo">
  <h2><a href="javascript:;" target="_self"><img src="http://hovertree.com/themes/hvtimages/hovertree.png"></a></h2>
 </div>
 <p>鼠標(biāo)移入側(cè)邊欄,二級(jí)菜單3D展開(kāi)<br/>鼠標(biāo)hover背景變色<br />鼠標(biāo)移入二維碼背景變色</p>
 <div  >
  <a >何問(wèn)起</a>
  <a  >說(shuō)明</a>
 </div>
</div>
<div class="nav-main">
<div class="nav-box">
<div class="nav">
 <ul class="nav-ul">
  <li><a  class="home"><span>首頁(yè)</span></a></li>
  <li><a  class="develop"><span>JavaScript</span></a></li>
  <li><a  class="wechat"><span>ASP.NET</span></a></li>
  <li><a  class="case"><span>何問(wèn)起鍵盤</span></a></li>
  <li><a  class="news"><span>HoverClock</span></a></li>
  <li><a  class="contact"><span>關(guān)于何問(wèn)起</span></a></li>
 </ul>
</div>
<div class="nav-slide">
 <div class="nav-slide-o"></div>
 <div class="nav-slide-o">
  <ul>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
   <li><a ><span>hewenqi</span></a></li>
  </ul>
 </div>
 <div class="nav-slide-o">
  <ul>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
   <li><a ><span>HoverTreeTop</span></a></li>
  </ul>
 </div>
 <div class="nav-slide-o">
  <ul>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
   <li><a ><span>何問(wèn)起題庫(kù)</span></a></li>
  </ul>
 </div>
 <div class="nav-slide-o">
  <ul>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
   <li><a ><span>網(wǎng)頁(yè)特效</span></a></li>
  </ul>
 </div>
 <div class="nav-slide-o"></div>
</div>
</div>
</div>
<script type="text/javascript" src="http://down.hovertree.com/jquery/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
 $(function(){
 var thisTime;
 $('.nav-ul li').mouseleave(function(even){
   thisTime = setTimeout(thisMouseOut,1000);
 })
 $('.nav-ul li').mouseenter(function(){
  clearTimeout(thisTime);
  var thisUB = $('.nav-ul li').index($(this));
  if($.trim($('.nav-slide-o').eq(thisUB).html()) != "")
  {
   $('.nav-slide').addClass('hover');
   $('.nav-slide-o').hide();
   $('.nav-slide-o').eq(thisUB).show();
  }
  else{
   $('.nav-slide').removeClass('hover');
  }
 })
 function thisMouseOut(){
  $('.nav-slide').removeClass('hover');
 }
 $('.nav-slide').mouseenter(function(){
  clearTimeout(thisTime);
  $('.nav-slide').addClass('hover');
 })
 $('.nav-slide').mouseleave(function(){
  $('.nav-slide').removeClass('hover');
 })
})
</script>
</body>
</html>

以上就是本文的全部?jī)?nèi)容,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能帶來(lái)一定的幫助,同時(shí)也希望多多支持億速云!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI