色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

jquery 彈出層實(shí)現(xiàn)代碼

經(jīng)過(guò)分析,網(wǎng)上的參考,終于搞定了~~
jQuery插件代碼:
復(fù)制代碼 代碼如下:
jQuery.fn.selectItem = function(targetId) {
var _seft = this;
var targetId = $(targetId);
this.toggle(
function() {
var A_top = $(this).offset().top + $(this).outerHeight(true); // 1
var A_left = $(this).offset().left;
targetId.bgiframe();
targetId.show().css({ "position": "absolute", "top": A_top + "px", "left": A_left + "px" });
}
, function() {
targetId.hide();
}
);
targetId.find("#selectItemClose").click(function() {
targetId.hide();
});
targetId.find("#selectSub :checkbox").click(function() {
targetId.find(":checkbox").attr("checked", false);
$(this).attr("checked", true);
_seft.val($(this).val());
targetId.hide();
});
$(document).click(function(event) {
if (event.target.id != _seft.selector.substring(1)) {
targetId.hide();
}
});
targetId.click(function(e) {
e.stopPropagation();
});
return this;
}

HTML代碼:
復(fù)制代碼 代碼如下:
<input type="text" id="txtCompetencies" value="All" readonly="readonly"/>
<div id="selectCompetencies">
<table>
<tbody>
<tr><td><input type="checkbox" />All</td></tr>
<tr><td><input type="checkbox" />Confidence</td></tr>
</tbody>
</table>
</div>

css樣式:
復(fù)制代碼 代碼如下:
/* pop div begin */
.selectItemcont{padding:8px;}
.selectItemtit{line-height:20px;height:20px;margin:1px;padding-left:12px;}
.bgc_ccc{background:#E88E22;}
.selectItemleft{float:left;margin:0px;padding:0px;font-size:12px;font-weight:bold;color:#fff;}
.selectItemright{float:right;cursor:pointer;color:#fff;}
.selectItemcls{clear:both;font-size:0px;height:0px;overflow:hidden;}
.selectItemhidden{display:none;}
#selectCompetencies
{
display:none;
background:#FFF;
position:absolute;
top:0px;
left:center;
border:1px solid #000;
overflow-x:hidden;
overflow-y:auto;
width:250px;
z-index:1000;
max-height:200px;
}
/* pop div end */

JavaScript代碼:
復(fù)制代碼 代碼如下:
$("#txtCompetencies").selectItem("#selectCompetencies");

實(shí)現(xiàn)點(diǎn)擊文本框,在其正下方彈出一個(gè)新的層,再次點(diǎn)擊的時(shí)候,隱藏層。
后面的話(huà),我會(huì)把這個(gè)插件繼續(xù)完善的~~~ O(∩_∩)O...

JavaScript技術(shù)jquery 彈出層實(shí)現(xiàn)代碼,轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 苏州市| 西贡区| 吴旗县| 合山市| 米林县| 宾川县| 洪雅县| 绥化市| 西城区| 塔城市| 临泉县| 永康市| 涞水县| 徐水县| 长乐市| 桃园市| 钦州市| 浑源县| 漠河县| 宜宾市| 株洲县| 易门县| 南江县| 乌兰县| 闽侯县| 连云港市| 中卫市| 苗栗县| 高密市| 高邮市| 琼中| 阳谷县| 怀来县| 德庆县| 北票市| 明溪县| 安阳县| 桐梓县| 洪洞县| 忻城县| 雅江县|