jQuery簡單實現(xiàn)仿京東分類導航層效果
本文實例講述了jQuery簡單實現(xiàn)仿京東分類導航層效果。分享給大家供大家參考,具體如下:
<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); //當前對象
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#桌面應用程序 C#網(wǎng)絡程序
</li>
</ul>
<ul class="unfocus">
<li ><strong>VC++</strong> <br />
VC++系統(tǒng)程序開發(fā) VC++網(wǎng)絡程序
</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擴展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)》
希望本文所述對大家jQuery程序設計有所幫助。
相關(guān)文章
jQuery實現(xiàn)級聯(lián)下拉框?qū)崙?zhàn)(5)
這篇文章主要為大家詳細介紹了jQuery實現(xiàn)級聯(lián)下拉框的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-02-02
jquery UI實現(xiàn)autocomplete在獲取焦點時得到顯示列表功能示例
這篇文章主要介紹了jquery UI實現(xiàn)autocomplete在獲取焦點時得到顯示列表功能,結(jié)合實例形式分析了jquery UI實現(xiàn)autocomplete事件響應及顯示下拉列表功能操作技巧,需要的朋友可以參考下2019-06-06
jquery亂碼與contentType屬性設置問題解決方案
讓人頭痛的Jquery亂碼問題。其實這方面文章已經(jīng)很多了,但全面解決各種問題的很少,今天總結(jié)一下,方便自己也方便大家,感興趣的朋友可以了解下哦2013-01-01

