jquery實現的可隱藏重現的靠邊懸浮層執行個體代碼

來源:互聯網
上載者:User

本執行個體使用jquery操作div的CSS,實現了可隱藏重現的靠邊懸浮層,預覽效果網址:http://www.keleyi.com/keleyi/phtml/xuanfudiv/
本執行個體使用到jquery添加移除類的兩個方法,詳細介紹請參考網址: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實現的可隱藏重現的靠邊懸浮層-指令碼之家</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;">可以滾動滑鼠使頁面向下</div>
<div style="background-color:Green; width:100%;height:150px;">www.keleyi.com</div>
<div style="background-color:Red; width:100%;height:150px;">請把游標移到箭頭上</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實現的可隱藏重現的靠邊懸浮層</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 href="http://www.keleyi.com/a/bjac/cdbc89174171ebb8.htm" 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 href="http://www.keleyi.com/menu/jquery/" target="_blank">jQuery</a>完整代碼</div>
<div class="offkeleyicom" id="xf_keleyi_com">
<div id="nr_keleyi_com">這裡是內容<br />www.keleyi.com
<ul>
<li><a href="http://www.keleyi.com/menu/net/" target="_blank">.NET</a>
</li>
<li><a href="http://www.keleyi.com/menu/javascript/" target="_blank">Javascript</a>
</li>
<li><a href="http://www.keleyi.com/menu/jquery/" target="_blank">jQuery</a>
</li>
<li><a href="http://www.keleyi.com/menu/csharp/" target="_blank">C#</a>
</li>
<li><a href="http://www.keleyi.com/menu/other/" target="_blank">其他</a>
</li>
</ul>
<br />
</div>
<div id="jt_keleyi_com"><img src="http://www.bkjia.com/uploads/allimg/131022/1U04II5-0.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>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.