<!DOCTYPE html> <html> <head> <title>jQuery Tools standalone demo</title> <!-- include the Tools --> <script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script> <!-- standalone page styling (can be removed) --> <link rel="stylesheet" type="text/css" href="./overlay-basic.css"/> <style> /* some styling for triggers */ #triggers { text-align:center; } #triggers img { cursor:pointer; margin:0 5px; background-color:#fff; border:1px solid #ccc; padding:2px; -moz-border-radius:4px; -webkit-border-radius:4px; } /* styling for elements inside overlay */ .details { position:absolute; top:15px; right:15px; font-size:11px; color:#fff; width:150px; } .details h3 { color:#aba; font-size:15px; } </style> </head> <body><!-- trigger elements --> <div id="triggers"> <img src="http://farm4.static.flickr.com/3651/3445879840_7ca4b491e9_m.jpg" rel="#mies1"/> <img src="http://farm4.static.flickr.com/3346/3449388113_71a06b8548_m.jpg" rel="#mies2"/> </div> <!-- overlays --> <div class="simple_overlay" id="mies1"> <img src="http://farm4.static.flickr.com/3651/3445879840_7ca4b491e9.jpg" /> <div class="details"> <h3>The Barcelona Pavilion</h3> <h4>Barcelona, Spain</h4> <p> The Barcelona Pavilion, designed by Ludwig Mies van der Rohe, was the German Pavilion for the 1929 International Exposition in Barcelona, Spain. It was an important building in the history of modern architecture. </p> <p> Several critics, historians and modernists have declared it "the most beautiful building of the century" </p> </div> </div> <div class="simple_overlay" id="mies2"> <img src="http://farm4.static.flickr.com/3346/3449388113_71a06b8548.jpg" /> <div class="details"> <h3>The Barcelona Pavilion</h3> <h4>Barcelona, Spain</h4> <p> Another unique feature of this building is the <em>exotic materials Mies chose to use</em>. </p> <p> Plates of high-grade stone materials like veneers of Tinos verde antico marble and golden onyx as well as tinted glass of grey, green, white, in addition to translucent glass, perform exclusively as spatial dividers. </p> </div> </div> <script> $(document).ready(function() { $("img[rel]").overlay({ closeOnClick:false, mask: 'darkred' }); }); </script> </body> </html>
CSS
/* the overlayed element */ .simple_overlay { /* must be initially hidden */ display:none; /* place overlay on top of other elements */ z-index:10000; /* styling */ background-color:#333; width:675px; min-height:200px; border:1px solid #666; /* CSS3 styling for latest browsers */ -moz-box-shadow:0 0 90px 5px #000; -webkit-box-shadow: 0 0 90px #000; } /* close button positioned on upper right corner */ .simple_overlay .close { background-image:url(./close.png); position:absolute; right:-15px; top:-15px; cursor:pointer; height:35px; width:35px; }
关闭的css的命名: xxx .close
属性
以下列出的是所有可用的属性选项:
| 属性 | 默认值 | 描述 |
|---|---|---|
| close | 。 | |
| closeOnClick | true |
。 |
| closeOnEsc | true |
默认情况下,覆盖网络时关闭键盘ESC键 |
| effect | 'default' |
效果时要使用打开包裹, 关闭。 这可以戏剧性地改变的行为 叠加。 默认情况下这个工具使用一种叫做'default'的影响 这是一个简单的显示/隐藏效果。 。 |
| fixed | true |
然后是定位在覆盖的 关系到文档,以便在屏幕上滚动 然后叠加与文档一起移动。 |
| mask |
。 这不是一个简单的字符串指定 面具的背景颜色或更复杂的对象文字 指定更多的配置变量。
。 默认情况下屏蔽是禁用的。 |
|
| left | "center" | ,但你也可以提供一个 数值指定的距离以像素为单位。 |
| load | false | 。 如果启用了然后覆盖的负载 后立即被初始化。 |
| oneInstance | true |
。 |
| speed | 'normal' | 淡入的速度动画的'normal' 效果。 有效值是 'slow', 'normal' 和 'fast',或者你也可以 提供一个数值(以毫秒为单位)。 通过设置这个 属性为0,则会出现滚动立即没有任何 动画。 |
| target | 属性的触发元素)。 | |
| top | '10%' | 指定如何远离屏幕的顶部边缘的叠加 应放置。 可接受的值是一个整数 指定一个距离(以像素为单位),一个字符串(如“15%”) 指定百分比值或“中心”在这种情况下 叠加是垂直居中。 百分数工作 一直保持在不同的屏幕分辨率。 |
事件
作为第一个参数并没有其他参数 为叠加。
| 事件 | 什么时候发生的? |
|---|---|
| onBeforeLoad | 叠加显示之前。 叠加已经 定位在该位置将从那里开始动画。 |
| onload | 当叠加已经完全被显示 |
| onBeforeClose | 关闭之前的叠加 |
| onClose | 当叠加是关闭的 |
API
。 以下列出的是所有可用的API方法:
| 方法 | 返回值类型 | 描述 |
|---|---|---|
| close() | Overlay | 关闭叠加。 |
| getClosers() | jQuery |
返回结束元素(s)作为一个jQuery对象。 |
| getConf() | 对象 |
将配置为叠加。 |
| getOverlay() | jQuery |
返回元素作为一个jQuery对象日程表。 |
| getTrigger() | jQuery |
返回元素作为一个jQuery对象触发。 |
| isOpened() | boolean | 如果打开包裹。 |
| load() | Overlay | 打开叠加。 |
明天再更新下时间那个就要为这个画一个句话。
tab:传送门
tab(幻灯片):传送门
tooltip:传送门
overlay:传送门
dateinput:传送门