PageRenderTime 28ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/gallery/spotlight/1.1/next-prev.html

https://github.com/akecn/kissy-gallery
HTML | 317 lines | 252 code | 43 blank | 22 comment | 0 complexity | c749ba455cf9b6edcefe207cfcb2a884 MD5 | raw file
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <style>
  6. body {
  7. margin: 0;
  8. padding: 0;
  9. }
  10. div.mask-target {
  11. display: inline-block;
  12. border-radius: 3px;
  13. border: 1px solid #A4D3F2;
  14. width: 30%;
  15. height: 200px;
  16. float: left;
  17. margin: 100px;
  18. *display: inline;
  19. zoom: 1
  20. }
  21. body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td {
  22. margin: 0;
  23. padding: 0;
  24. }
  25. table {
  26. border-collapse: collapse;
  27. border-spacing: 0;
  28. }
  29. .popup {
  30. position: absolute;
  31. z-index: 50;
  32. border-collapse: collapse;
  33. visibility: hidden;
  34. }
  35. .popup td.corner {
  36. height: 15px;
  37. width: 19px;
  38. }
  39. .popup td#topleft {
  40. background-image: url(../tmp/images/bubble-1.png);
  41. }
  42. .popup td.top {
  43. background-image: url(../tmp/images/bubble-2.png);
  44. }
  45. .popup td#topright {
  46. background-image: url(../tmp/images/bubble-3.png);
  47. }
  48. .popup td.left {
  49. background-image: url(../tmp/images/bubble-4.png);
  50. }
  51. .popup td.right {
  52. background-image: url(../tmp/images/bubble-5.png);
  53. }
  54. .popup td#bottomleft {
  55. background-image: url(../tmp/images/bubble-6.png);
  56. }
  57. .popup td.bottom {
  58. background-image: url(../tmp/images/bubble-7.png);
  59. text-align: center;
  60. }
  61. .popup td.bottom img {
  62. display: block;
  63. margin: 0 auto;
  64. }
  65. .popup td#bottomright {
  66. background-image: url(../tmp/images/bubble-8.png);
  67. }
  68. .popup table.popup-contents {
  69. font-size: 12px;
  70. line-height: 1.2em;
  71. background-color: #fff;
  72. color: #666;
  73. font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", sans-serif;
  74. }
  75. table.popup-contents th {
  76. text-align: right;
  77. text-transform: lowercase;
  78. }
  79. table.popup-contents td {
  80. text-align: left;
  81. }
  82. tr#release-notes th {
  83. text-align: left;
  84. text-indent: -9999px;
  85. height: 17px;
  86. }
  87. tr#release-notes td a {
  88. color: #333;
  89. }
  90. .ks-overlay {
  91. position: absolute;
  92. left: -9999px;
  93. top: -9999px;
  94. z-index: 9999;
  95. }
  96. #pp-content {
  97. padding: 10px
  98. }
  99. </style>
  100. <script src="http://a.tbcdn.cn/s/kissy/1.3.0/kissy.js" charset="utf-8"></script>
  101. <script>
  102. KISSY.config({
  103. packages: [
  104. {
  105. name: "gallery",
  106. tag: "20111220",
  107. path: "../../../", // cdn上适当修改对应路径
  108. charset: "utf-8"
  109. }
  110. ]
  111. });
  112. KISSY.use('gallery/spotlight/1.1/,overlay', function (S, Spotlight, overlay) {
  113. S.ready(function () {
  114. var nodes = S.DOM.query('.mask-target')
  115. , arrNode = []
  116. , nextBtns = S.all('button.next')
  117. , prevBtns = S.all('button.prev')
  118. , listText = [];
  119. var popup = new overlay.Popup(
  120. {
  121. srcNode: S.get('#drop')
  122. }
  123. )
  124. ;
  125. S.log(popup.get("el"));
  126. popup.on('show', function () {
  127. var el = popup.get('el') , top = el.offset().top;
  128. el.stop()
  129. el.css({top: top + 20, opacity: 0})
  130. S.Anim(el, {
  131. opacity: 1, top: top
  132. }, .2).run()
  133. })
  134. S.each(nodes, function (item, i) {
  135. arrNode.push({node: item});
  136. listText.push(Array(10).join(i + ''))
  137. })
  138. popup.align(
  139. S.one(nodes[0])
  140. , ['tc', 'bc']
  141. , [0, 20]
  142. );
  143. var spot = new Spotlight({
  144. quene: arrNode, anim: {
  145. duration: .1
  146. }, opacity: .3, zIndex: 9000, toggleOnAnim: false, listeners: {
  147. hide: function () {
  148. nextBtns.attr('disabled', true);
  149. prevBtns.attr('disabled', true);
  150. popup.hide();
  151. }, focusTo: function (e) {
  152. popup.hide();
  153. S.one('#pp-content').html(listText[e.index])
  154. setTimeout(function () {
  155. popup.align(
  156. S.one(e.nodeTarget)
  157. , ['tc', 'bc']
  158. , [0, 20]
  159. );
  160. popup.show();
  161. nextBtns.attr('disabled', false);
  162. prevBtns.attr('disabled', false);
  163. }, 300)
  164. }
  165. }
  166. });
  167. S.one('button').on('click', function () {
  168. spot.start();
  169. });
  170. nextBtns.attr('disabled', true).on('click', function () {
  171. spot.canNext() ? spot.nextFocus() : spot.end();
  172. });
  173. prevBtns.attr('disabled', true).on('click', function () {
  174. spot.canPrevious() ? spot.prevFocus() : spot.end();
  175. });
  176. })
  177. })
  178. </script>
  179. </head>
  180. <body>
  181. <button>start</button>
  182. <div>
  183. <div class="mask-target">
  184. <img src="http://a.tbcdn.cn/s/kissy/logo.png"/>
  185. <div>
  186. <button class="next">next</button>
  187. <button class="prev">prev</button>
  188. </div>
  189. </div>
  190. <div class="mask-target">
  191. <img src="http://a.tbcdn.cn/s/kissy/logo.png"/>
  192. <div>
  193. <button class="next">next</button>
  194. <button class="prev">prev</button>
  195. </div>
  196. </div>
  197. <div class="mask-target">
  198. <img src="http://a.tbcdn.cn/s/kissy/logo.png"/>
  199. <div>
  200. <button class="next">next</button>
  201. <button class="prev">prev</button>
  202. </div>
  203. </div>
  204. <div class="mask-target">
  205. <img src="http://a.tbcdn.cn/s/kissy/logo.png"/>
  206. <div>
  207. <button class="next">next</button>
  208. <button class="prev">prev</button>
  209. </div>
  210. </div>
  211. <div class="mask-target">
  212. <img src="http://a.tbcdn.cn/s/kissy/logo.png"/>
  213. <div>
  214. <button class="next">next</button>
  215. <button class="prev">prev</button>
  216. </div>
  217. </div>
  218. <div class="mask-target">
  219. <img src="http://a.tbcdn.cn/s/kissy/logo.png"/>
  220. <div>
  221. <button class="next">next</button>
  222. <button class="prev">prev</button>
  223. </div>
  224. </div>
  225. </div>
  226. <div class="popup ks-popup ks-overlay ks-ext-position" id="drop">
  227. <div class="ks-contentbox ">
  228. <table>
  229. <tbody>
  230. <tr>
  231. <td class="corner" id="topleft"></td>
  232. <td class="top"></td>
  233. <td class="corner" id="topright"></td>
  234. </tr>
  235. <tr>
  236. <td class="left"></td>
  237. <td>
  238. <div class="popup-contents" id="pp-content" style="background-color:#fff"></div>
  239. <!-- <table class="popup-contents">
  240. <tbody><tr>
  241. <th>File:</th>
  242. <td>coda 1.7.zip</td>
  243. </tr>
  244. <tr>
  245. <th>Date:</th>
  246. <td>11/5/10</td>
  247. </tr>
  248. <tr>
  249. <th>Size:</th>
  250. <td>20 MB</td>
  251. </tr>
  252. <tr>
  253. <th>Req:</th>
  254. <td>Mac OS X 10.4+</td>
  255. </tr>
  256. <tr id="release-notes">
  257. <th>Read the release notes:</th>
  258. <td><a href="#" title="Read the release notes">release notes</a></td>
  259. </tr>
  260. </tbody></table> -->
  261. </td>
  262. <td class="right"></td>
  263. </tr>
  264. <tr>
  265. <td id="bottomleft" class="corner"></td>
  266. <td class="bottom"><img src="../tmp/images/bubble-tail2.png" width="30" height="29" alt="popup tail"></td>
  267. <td class="corner" id="bottomright"></td>
  268. </tr>
  269. </tbody>
  270. </table>
  271. </div>
  272. </div>
  273. </body>
  274. </html>