DIV CSS 佈局教程網

jQuery 實作右上角可關閉重開的浮動層
編輯:JQuery常見問題     

效果體驗請點擊這裡。

這個菜單很適合做成線上客服之類的功能:點擊後向下滑出,並帶有關閉按鈕,因此在不顯示時可以隨時把它收起來。以下是原始碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>頁面右上角可關閉重開的層-</title><base target="_blank" />
 <style>
 #opciones {
   z-index: 7000;
   position: fixed;
   padding-bottom: 10px;
   padding-left: 10px;
   width: 120px;
   padding-right: 10px;
   font: 12px/140% Arial, Helvetica, sans-serif;
   background: #e7e7e7;
   color: #999;
   top: 0px;
   right: 0px;
   padding-top: 10px;
 }
 #opciones ul { padding: 0px; margin: 0px; }
 #opciones li { list-style: none; text-align: left; }
 #settings {
   z-index: 8000;
   position: fixed;
   text-indent: -99999px;
   width: 43px;
   display: block;
   background: url(https:///keleyi/phtml/jqtexiao/22/opciones.gif) no-repeat 0px 0px;
   height: 43px;
   top: 0px;
   cursor: pointer;
   right: 0px;
 }
 </style>
 <script type="text/javascript" src="https:///keleyi/pmedia/jquery/jquery-1.11.0.min.js"></script>
 <script type="text/javascript">
 $(document).ready(function () {
   $('#opciones').hide();
   $('#settings').click(function () {
     $('#opciones').slideToggle();
     $(this).toggleClass("cerrar");
   });
 });
 </script>
</head>
<body style="text-align: center">
 <div id="settings">Settings</div>
 <div id="opciones">
 <ul>
 <li><a href="https:///a/bjad/w0ysw5u6.htm" target="_blank">jQuery.now() 函數介紹</a></li>
 <li><a href="https:///a/bjad/m6mamp34.htm">(function($){….})</a></li>
 </ul>
 </div>
 <div><h2>頁面右上角可關閉重開的層</h2>
 請點擊右上角的圖標 <a href="https:///a/bjad/27095rgj.htm">原文</a>
 </div>
</body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved