jquery實現(xiàn)的可隱藏重現(xiàn)的靠邊懸浮層實例代碼
更新時間:2013年05月27日 17:26:46 作者:
本實例使用jquery操作div的CSS實現(xiàn)了可隱藏重現(xiàn)的靠邊懸浮層,具體實現(xiàn)代碼如下,感興趣的朋友可以參考下哈
本實例使用jquery操作div的CSS,實現(xiàn)了可隱藏重現(xiàn)的靠邊懸浮層,預(yù)覽效果網(wǎng)址:http://www.keleyi.com/keleyi/phtml/xuanfudiv/
本實例使用到j(luò)query添加移除類的兩個方法,詳細(xì)介紹請參考網(wǎng)址:http://www.keleyi.com/a/bjac/e9e40a974de5a902.htm
下面給出完整代碼,保存到html文件可查看效果。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jquery實現(xiàn)的可隱藏重現(xiàn)的靠邊懸浮層-腳本之家</title>
<script type="text/javascript" src="http://www.keleyi.com/keleyi/pmedia/jquery-1.9.1.min.js"></script>
<style type="text/css">
body{ margin:0px;}
.onkeleyicom{left:0px;}
.offkeleyicom{left:-140px;}
.showkeleyicom{visibility:visible;}
.hidekeleyicom{visibility:hidden;}
#xf_keleyi_com{width:166px;height:200px; background-color:transparent;position:fixed;top:200px;}
#jt_keleyi_com{float:right;width:25px;height:25px;margin-top:80px;}
#nr_keleyi_com{float:left;height:100%;width:136px;background-color:Silver;}
</style>
</head>
<body>
<div style="background-color:#959822; width:100%;height:150px;">可以滾動鼠標(biāo)使頁面向下</div>
<div style="background-color:Green; width:100%;height:150px;">www.keleyi.com</div>
<div style="background-color:Red; width:100%;height:150px;">請把光標(biāo)移到箭頭上</div>
<div style="background-color:Yellow; width:100%;height:150px;">hi</div>
<div style="background-color:Silver; width:100%;height:150px;">柯樂義</div>
<div style="background-color:Aqua; width:100%;height:150px;">keleyi.com</div>
<div style="background-color:Fuchsia; width:100%;height:150px;">keleyi</div>
<div style="background-color:Green; width:100%;height:150px;">keleyi.com</div>
<div style="background-color:Blue; width:100%;height:150px;">柯樂義</div>
<div style="background-color:Olive; width:100%;height:150px;">柯樂義 jquery實現(xiàn)的可隱藏重現(xiàn)的靠邊懸浮層</div>
<div style="background-color:Green; width:100%;height:150px;">A</div>
<div style="background-color:Purple; width:100%;height:150px;">jquery</div>
<div style="background-color:Green; width:100%;height:150px;"><a target="_blank">原文</a></div>
<div style="background-color:Lime; width:100%;height:150px;">keleyi.com</div>
<div style="background-color:Orange; width:100%;height:150px;"><a target="_blank">jQuery</a>完整代碼</div>
<div class="offkeleyicom" id="xf_keleyi_com">
<div id="nr_keleyi_com">這里是內(nèi)容<br />www.keleyi.com
<ul>
<li><a target="_blank">.NET</a>
</li>
<li><a target="_blank">Javascript</a>
</li>
<li><a target="_blank">jQuery</a>
</li>
<li><a target="_blank">C#</a>
</li>
<li><a target="_blank">其他</a>
</li>
</ul>
<br />
</div>
<div id="jt_keleyi_com"><img src="http://www.keleyi.com/keleyi/pmedia/rightarrow.jpg" alt="顯示" /></div>
</div>
<script type="text/javascript">
$(document).ready(
function () {
$('#jt_keleyi_com').bind('mouseover', function () {
$('#xf_keleyi_com').removeClass("offkeleyicom");
$('#xf_keleyi_com').addClass("onkeleyicom");
$('#jt_keleyi_com').addClass("hidekeleyicom");
$('#jt_keleyi_com').removeClass("showkeleyicom");
})
$('#nr_keleyi_com').bind('mouseleave', function () {
$('#xf_keleyi_com').removeClass("onkeleyicom");
$('#xf_keleyi_com').addClass("offkeleyicom");
$('#jt_keleyi_com').removeClass("hidekeleyicom");
$('#jt_keleyi_com').addClass("showkeleyicom");
})
})
</script>
</body>
</html>
本實例使用到j(luò)query添加移除類的兩個方法,詳細(xì)介紹請參考網(wǎng)址:http://www.keleyi.com/a/bjac/e9e40a974de5a902.htm
下面給出完整代碼,保存到html文件可查看效果。
復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jquery實現(xiàn)的可隱藏重現(xiàn)的靠邊懸浮層-腳本之家</title>
<script type="text/javascript" src="http://www.keleyi.com/keleyi/pmedia/jquery-1.9.1.min.js"></script>
<style type="text/css">
body{ margin:0px;}
.onkeleyicom{left:0px;}
.offkeleyicom{left:-140px;}
.showkeleyicom{visibility:visible;}
.hidekeleyicom{visibility:hidden;}
#xf_keleyi_com{width:166px;height:200px; background-color:transparent;position:fixed;top:200px;}
#jt_keleyi_com{float:right;width:25px;height:25px;margin-top:80px;}
#nr_keleyi_com{float:left;height:100%;width:136px;background-color:Silver;}
</style>
</head>
<body>
<div style="background-color:#959822; width:100%;height:150px;">可以滾動鼠標(biāo)使頁面向下</div>
<div style="background-color:Green; width:100%;height:150px;">www.keleyi.com</div>
<div style="background-color:Red; width:100%;height:150px;">請把光標(biāo)移到箭頭上</div>
<div style="background-color:Yellow; width:100%;height:150px;">hi</div>
<div style="background-color:Silver; width:100%;height:150px;">柯樂義</div>
<div style="background-color:Aqua; width:100%;height:150px;">keleyi.com</div>
<div style="background-color:Fuchsia; width:100%;height:150px;">keleyi</div>
<div style="background-color:Green; width:100%;height:150px;">keleyi.com</div>
<div style="background-color:Blue; width:100%;height:150px;">柯樂義</div>
<div style="background-color:Olive; width:100%;height:150px;">柯樂義 jquery實現(xiàn)的可隱藏重現(xiàn)的靠邊懸浮層</div>
<div style="background-color:Green; width:100%;height:150px;">A</div>
<div style="background-color:Purple; width:100%;height:150px;">jquery</div>
<div style="background-color:Green; width:100%;height:150px;"><a target="_blank">原文</a></div>
<div style="background-color:Lime; width:100%;height:150px;">keleyi.com</div>
<div style="background-color:Orange; width:100%;height:150px;"><a target="_blank">jQuery</a>完整代碼</div>
<div class="offkeleyicom" id="xf_keleyi_com">
<div id="nr_keleyi_com">這里是內(nèi)容<br />www.keleyi.com
<ul>
<li><a target="_blank">.NET</a>
</li>
<li><a target="_blank">Javascript</a>
</li>
<li><a target="_blank">jQuery</a>
</li>
<li><a target="_blank">C#</a>
</li>
<li><a target="_blank">其他</a>
</li>
</ul>
<br />
</div>
<div id="jt_keleyi_com"><img src="http://www.keleyi.com/keleyi/pmedia/rightarrow.jpg" alt="顯示" /></div>
</div>
<script type="text/javascript">
$(document).ready(
function () {
$('#jt_keleyi_com').bind('mouseover', function () {
$('#xf_keleyi_com').removeClass("offkeleyicom");
$('#xf_keleyi_com').addClass("onkeleyicom");
$('#jt_keleyi_com').addClass("hidekeleyicom");
$('#jt_keleyi_com').removeClass("showkeleyicom");
})
$('#nr_keleyi_com').bind('mouseleave', function () {
$('#xf_keleyi_com').removeClass("onkeleyicom");
$('#xf_keleyi_com').addClass("offkeleyicom");
$('#jt_keleyi_com').removeClass("hidekeleyicom");
$('#jt_keleyi_com').addClass("showkeleyicom");
})
})
</script>
</body>
</html>
您可能感興趣的文章:
- jquery鼠標(biāo)放上去顯示懸浮層即彈出定位的div層
- 使用jQuery UI的tooltip函數(shù)修飾title屬性的氣泡懸浮框
- 自定義一個jquery插件[鼠標(biāo)懸浮時候 出現(xiàn)說明label]
- jquery實現(xiàn)鼠標(biāo)懸浮停止輪播特效
- jquery懸浮提示框完整實例
- 鼠標(biāo)懸浮顯示二級菜單效果的jquery實現(xiàn)
- jQuery實現(xiàn)懸浮在右上角的網(wǎng)頁客服效果代碼
- jQuery簡單實現(xiàn)頁面元素置頂時懸浮效果示例
- jQuery鼠標(biāo)懸浮鏈接彈出跟隨圖片實例代碼
- jQuery實現(xiàn)的簡單懸浮層功能完整實例
相關(guān)文章
jQuery的實現(xiàn)原理的模擬代碼 -1 核心部分
最近又看了一下 jQuery 1.4.2, 為了便于理解,將 jQuery 的核心使用比較簡單的代碼模擬一下。方便學(xué)習(xí)。2010-08-08
jQuery動態(tài)添加 input type=file的實現(xiàn)代碼
有時候需要在頁面上允許用戶上傳多個文件,個數(shù)由用戶自己決定,個數(shù)多了也可以刪除,使用jQuery可以很簡單的實現(xiàn)這個功能2012-06-06
jQuery實現(xiàn)智能判斷固定導(dǎo)航條或側(cè)邊欄的方法
這篇文章主要介紹了jQuery實現(xiàn)智能判斷固定導(dǎo)航條或側(cè)邊欄的方法,涉及jQuery針對頁面元素屬性的判斷與動態(tài)操作相關(guān)技巧,需要的朋友可以參考下2016-09-09
ASP.NET jQuery 實例6 (實現(xiàn)CheckBoxList成員全選或全取消)
ASP.NET jQuery 實例6 (實現(xiàn)CheckBoxList成員全選或全取消) ,需要的朋友可以參考下。2012-01-01
jQuery ui實現(xiàn)動感的圓角漸變網(wǎng)站導(dǎo)航菜單效果代碼
這篇文章主要介紹了jQuery ui實現(xiàn)動感的圓角漸變網(wǎng)站導(dǎo)航菜單效果代碼,涉及jquery插件構(gòu)造圓角圖形及頁面過度效果的相關(guān)技巧,具有一定參考借鑒價值,需要的朋友可以參考下2015-08-08
jQuery實現(xiàn)動態(tài)添加tr到table的方法
這篇文章主要介紹了jQuery實現(xiàn)動態(tài)添加tr到table的方法,涉及jQuery針對table表格元素的動態(tài)操作相關(guān)技巧,需要的朋友可以參考下2016-12-12

