欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery簡單實現(xiàn)仿京東分類導(dǎo)航層效果

 更新時間:2016年06月07日 11:07:31   作者:smartsmile2012  
這篇文章主要介紹了jQuery簡單實現(xiàn)仿京東分類導(dǎo)航層效果,涉及jQuery針對鼠標(biāo)事件的響應(yīng)及頁面元素動態(tài)操作技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了jQuery簡單實現(xiàn)仿京東分類導(dǎo)航層效果。分享給大家供大家參考,具體如下:

<script src="jquery-1.11.1.min.js" type="text/javascript"></script>
<script type="text/javascript">
  $(function () {
    var alink01 = $(".item > ul");
    alink01.hover(function () {
      //alert div
      var divId = $(this).find("div").attr("id");
      var div = $("#" + divId); //要浮動在這個元素旁邊的層
      div.css("position", "absolute"); //讓這個層可以絕對定位
      var self = $(this); //當(dāng)前對象
      div.css("display", "block");
      var p = self.position(); //獲取這個元素的left和top
      var x = p.left + self.width(); //獲取這個浮動層的left
      div.css("left", x + 45); //20140916修改
      div.css("top", p.top);
      div.show();
      //mouseenter
      $(this).removeClass("unfocus").addClass("focus");
    },
    function () {
      var divId = $(this).find("div").attr("id");
      var div = $("#" + divId); //要浮動在這個元素旁邊的層
      div.css("display", "none");
      //mouseleave
      $(this).removeClass("focus").addClass("unfocus");
    });
  });
</script>

<div class="leftbody">
  <div class="item">
  <span>全部分類</span>
  <ul class="focus">
    <li ><strong>php</strong> <br />
    php基本語法 php實例
    </li>
  </ul>
  <ul class="unfocus">
    <li ><strong>java</strong> <br />
    java語法 java面向?qū)ο?
    </li>
  </ul>
  <ul class="unfocus">
    <li ><strong>Python</strong> <br />
    Python語法 Python圖形處理
    </li>
  </ul>
  <ul class="unfocus">
    <li ><strong>javascript</strong> <br />
    javascript幻燈片 javascript網(wǎng)頁特效
    </li>
  </ul>
  <ul class="unfocus">
    <li ><strong>C#</strong> <br />
    C#桌面應(yīng)用程序 C#網(wǎng)絡(luò)程序
    </li>
  </ul>
  <ul class="unfocus">
    <li ><strong>VC++</strong> <br />
    VC++系統(tǒng)程序開發(fā) VC++網(wǎng)絡(luò)程序
    </li>
  </ul>
  <ul class="unfocus">
    <li ><strong>Delphi</strong> <br />
    Delphi桌面程序 Delphi游戲開發(fā)
    </li>
  </ul>
  </div>
</div>

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jquery中Ajax用法總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)

希望本文所述對大家jQuery程序設(shè)計有所幫助。

相關(guān)文章

最新評論