jq選項(xiàng)卡鼠標(biāo)延遲的插件實(shí)例
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="js/jquery-1.7.min.js"></script>
<head>
<title>選項(xiàng)卡插件制作</title>
<style type="text/css">
*{margin: 0;padding: 0}
.tab{width: 350px;margin: 100px auto;}
.tabnav li{ list-style:none;cursor:pointer;float: left;width: 80px;border: 1px solid #ccc;border-radius: 5px;margin-right: 5px; height:24px;line-height: 24px;text-align: center;}
.tabnav li.cur{background:#daa520;}
.tabcontent{display: none;padding: 20px;}
.tabcon{border: 1px #708090 solid;background: #ffc0cb;height: 300px;clear: both;}
</style>
</head>
<script>
(function($){
$.fn.extend({
myTab:function(options){
var confings={
tabNav:'',//tab導(dǎo)航名稱
tabTag:'',//tab導(dǎo)航標(biāo)簽
tabCon:'',//tab內(nèi)容名稱
conTag:'',//tab內(nèi)容標(biāo)簽和其他的類名
method: 'click'//鼠標(biāo)事件狀態(tài)
};//默認(rèn)設(shè)置
options= $.extend(confings,options);
var that=$(this);
var tagnav=$(confings.tabNav);
var tabLi=tagnav.find(confings.tabTag);
var tabcon=$(confings.tabCon);
var tabUl=tabcon.find(confings.conTag);
var timoutid=null;
tabLi.each(function(ind){
$(this).bind(options.method,function(){
var liNode = $(this);
timoutid = setTimeout(function(){ //鼠標(biāo)不小心劃過的延遲時(shí)間
tabUl.hide();
tabLi.removeClass("cur");
tabUl.eq(ind).show();
liNode.addClass("cur");
},300);
}).mouseout(function(){
clearTimeout(timoutid);
});
})
return this;
}
})
})(jQuery);
$(function(){
$("#testtab5").myTab({
tabNav:"#tabtag5",tabTag:"li",tabCon:"#tabcon5",conTag:".tabcontent",method:"mouseover"
});
$("#testtab").myTab({
tabNav:"#tabtag",tabTag:"li",tabCon:"#tabcon",conTag:".tabcontent"
});
})
</script>
<body>
<div class="tab" id="testtab5">
<div class="tabnav" id="tabtag5">
<ul>
<li class="cur">菜單一</li>
<li>菜單二</li>
<li>菜單三</li>
</ul>
</div>
<div class="tabcon" id="tabcon5">
<div class="tabcontent" style="display: block;">內(nèi)容一</div>
<div class="tabcontent">內(nèi)容二</div>
<div class="tabcontent">內(nèi)容三</div>
</div>
<div style="clear: both;margin-top: 60px;">
<div class="tab" id="testtab">
<div class="tabnav" id="tabtag">
<ul>
<li class="cur">菜單一</li>
<li>菜單二</li>
<li>菜單三</li>
</ul>
</div>
<div class="tabcon" id="tabcon">
<div class="tabcontent" style="display: block;">內(nèi)容一</div>
<div class="tabcontent">內(nèi)容二</div>
<div class="tabcontent">內(nèi)容三</div>
</div>
</div>
</div>
</div>
</body>
</html>
- JavaScript版TAB選項(xiàng)卡效果實(shí)例
- jQuery自動(dòng)切換/點(diǎn)擊切換選項(xiàng)卡效果的小例子
- jsp js鼠標(biāo)移動(dòng)到指定區(qū)域顯示選項(xiàng)卡離開時(shí)隱藏示例
- jQuery學(xué)習(xí)筆記(3)--用jquery(插件)實(shí)現(xiàn)多選項(xiàng)卡功能
- 自定義jQuery選項(xiàng)卡插件實(shí)例
- jquery多選項(xiàng)卡效果實(shí)例代碼(附效果圖)
- android 選項(xiàng)卡(TabHost)如何放置在屏幕的底部
- Tab切換組件(選項(xiàng)卡功能)實(shí)例代碼
相關(guān)文章
jQuery+ajax實(shí)現(xiàn)滾動(dòng)到頁(yè)面底部自動(dòng)加載圖文列表效果(類似圖片懶加載)
這篇文章主要介紹了jQuery+ajax實(shí)現(xiàn)滾動(dòng)到頁(yè)面底部自動(dòng)加載圖文列表效果,模擬圖片懶加載功能,涉及jQuery的ajax與asp.net交互動(dòng)態(tài)顯示頁(yè)面內(nèi)容的相關(guān)技巧,需要的朋友可以參考下2016-06-06
jQuery實(shí)現(xiàn)鼠標(biāo)跟隨提示層效果代碼(可顯示文本,Div,Table,Html等)
這篇文章主要介紹了jQuery實(shí)現(xiàn)鼠標(biāo)跟隨提示層效果代碼,具備顯示文本,Div,Table,Html等功能.涉及jQuery針對(duì)鼠標(biāo)事件及頁(yè)面元素的相關(guān)操作技巧,需要的朋友可以參考下2016-04-04
jQuery點(diǎn)擊tr實(shí)現(xiàn)checkbox選中的方法
jQuery點(diǎn)擊tr實(shí)現(xiàn)checkbox選中的方法,需要的朋友可以參考一下2013-03-03
深入理解JQuery keyUp和keyDown的區(qū)別
這篇文章主要是對(duì)JQuery中keyUp與keyDown的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以過來參考下,希望對(duì)大家有所幫助2013-12-12
jquery刪除指定的html標(biāo)簽并保留標(biāo)簽內(nèi)文本內(nèi)容的方法
有時(shí)我們希望刪除這段html代碼里面的一對(duì)<p>標(biāo)簽,但是要保持里面的內(nèi)容不被刪除,本文提供的這個(gè)jquery方法就可以簡(jiǎn)單實(shí)現(xiàn)。2014-04-04
jQuery中創(chuàng)建實(shí)例與原型繼承揭秘
在普通情況下我們要用原生類、或者自定義類創(chuàng)建實(shí)例要用new運(yùn)算符,使構(gòu)造函數(shù)創(chuàng)建一個(gè)實(shí)例,并且實(shí)例繼承構(gòu)造器prototype上的所有公有方法2011-12-12
jquery獲取復(fù)選框checkbox的值的簡(jiǎn)單實(shí)現(xiàn)方法
下面小編就為大家?guī)硪黄猨query獲取復(fù)選框checkbox的值的簡(jiǎn)單實(shí)現(xiàn)方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05

