You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

324 lines
10 KiB

  1. ---
  2. layout : 'default'
  3. css : 'popup'
  4. title : 'Popup'
  5. description : 'A popup displays additional information on top of a page element'
  6. type : 'UI Module'
  7. ---
  8. <script src="/javascript/popup.js"></script>
  9. <%- @partial('header') %>
  10. <div class="main container">
  11. <div class="peek">
  12. <div class="ui vertical pointing secondary menu">
  13. <a class="active item">Types</a>
  14. <a class="item">Variations</a>
  15. <a class="item">Usage</a>
  16. <a class="item">Examples</a>
  17. <a class="item">Settings</a>
  18. </div>
  19. </div>
  20. <h2 class="ui dividing header">Types</h2>
  21. <div class="example">
  22. <h4 class="ui header">Popup</h4>
  23. <p>A standard popup</p>
  24. <i class="large heart circular icon link" data-content="Hello, I am a pop-up."></i>
  25. </div>
  26. <h2 class="ui dividing header">Variations</h2>
  27. <div class="example">
  28. <h4 class="ui header">Size</h4>
  29. <p>A popup can be large or small</p>
  30. <i class="circular heart icon link" data-content="Hello. This is a small popup" data-variation="small"></i>
  31. <i class="circular heart icon link" data-content="Hello. This is a large popup" data-variation="large"></i>
  32. </div>
  33. <div class="example">
  34. <h4 class="ui header">Inverted</h4>
  35. <p>A popup can have its colors inverted</p>
  36. <i class="circular heart icon link" data-content="Hello. This is an inverted popup" data-variation="inverted"></i>
  37. </div>
  38. <h2 class="ui dividing header">Usage</h2>
  39. <h4 class="ui header">Initializing an popup</h4>
  40. <div class="code">
  41. $('.ui.popup')
  42. .popup()
  43. ;
  44. </div>
  45. <h4 class="ui header">Including metadata</h4>
  46. <p>Frequently used metadata like, title, content, html, or arrowOffset or variation, can be included in html metadata<p>
  47. <div class="ui info icon ignored message">
  48. <i class="info icon"></i>
  49. <div class="content">
  50. <div class="header">Specifying Content</div>
  51. <p>Popups can specify content in three ways:<p>
  52. <ul class="list">
  53. <li>Using html title attribute</li>
  54. <li>Using data-content attribute</li>
  55. <li>Using the content property in the initialization of the popup</li>
  56. </ul>
  57. </div>
  58. </div>
  59. <div class="code" data-type="html">
  60. <i class="circular heart icon link" data-content="Here is some popup content." data-position="top left" data-variation="black"></i>
  61. </div>
  62. <h2 class="ui dividing header">Examples</h2>
  63. <div class="example segment">
  64. <h4 class="ui header">Inline or Body</h4>
  65. <p>A popup can either be inserted directly after an element, or added as a child element to the page's <code>body</code>.</p>
  66. <div class="ui warning message">
  67. An inline popup will remain in your page's html after being hidden, while a non-inline popup will remove itself after being hidden.
  68. </div>
  69. <div class="ui info message">
  70. If you want to style each popup individually it makes sense to keep popup <code>inline: true</code>. If you are worried that your pop up might mistakingly inherit styles that it shouldn't, you should set <code>inline: false</code>.
  71. </div>
  72. <div class="evaluated code">
  73. $('.page.icon')
  74. .popup({
  75. inline: false
  76. })
  77. ;
  78. $('.inline.icon')
  79. .popup({
  80. inline: true
  81. })
  82. ;
  83. </div>
  84. <i class="mail page circular icon link" data-content="This is a child element to the page's body" ></i>
  85. <i class="mail inline circular icon link" data-content="This is sibling of the icon" ></i>
  86. </div>
  87. <div class="example segment">
  88. <h4 class="ui header">Positioning</h4>
  89. <p>A popup can be positioned to any side of an element. If space is not available, it will automatically search for a similar alternative position to use.</p>
  90. <i class="circular heart icon link" data-content="Top Left" data-position="top left"></i>
  91. <i class="circular heart icon link" data-content="Top Center" data-position="top center"></i>
  92. <i class="circular heart icon link" data-content="Top Right" data-position="top right"></i>
  93. <i class="circular heart icon link" data-content="Left Center" data-position="left center"></i>
  94. <i class="circular heart icon link" data-content="Right Center" data-position="right center"></i>
  95. <i class="circular heart icon link" data-content="Bottom Left" data-position="bottom left"></i>
  96. <i class="circular heart icon link" data-content="Bottom Center" data-position="bottom center"></i>
  97. <i class="circular heart icon link" data-content="Bottom Right" data-position="bottom right"></i>
  98. </div>
  99. <div class="example segment">
  100. <h4 class="ui header">Title</h4>
  101. <p>A popup can be formatted with a title</p>
  102. <i class="circular heart icon link" data-title="Dog Breeds" data-content="There are many types of dogs. We don't have time to list them all"></i>
  103. </div>
  104. <div class="example segment">
  105. <h4 class="ui header">HTML</h4>
  106. <p>A popup can be formatted with html</p>
  107. <i class="circular heart icon link" data-html="<strike>I rescind my comment about cats</strike>"></i>
  108. </div>
  109. <div class="no example">
  110. <h4 class="ui header">Transitions</h4>
  111. <p>A popup can have different <a href="/modules/transition.html">transitions</a>. Any transition with both an in and out animation can be specified. The following are just a few examples.</p>
  112. <i class="heart icon fade link" data-content="This is a different transition"></i>
  113. <br><br>
  114. <div class="code" data-demo="true" data-title="Fade">
  115. $('.fade.icon')
  116. .popup('setting', 'transition', 'fade up')
  117. .popup('toggle')
  118. ;
  119. </div>
  120. </div>
  121. <div class="no example">
  122. <i class="heart icon slide link" data-content="This is a different transition"></i>
  123. <br><br>
  124. <div class="code" data-demo="true" data-title="Slide Up">
  125. $('.slide.icon')
  126. .popup('setting', 'transition', 'slide up')
  127. .popup('toggle')
  128. ;
  129. </div>
  130. </div>
  131. <div class="no example">
  132. <i class="heart icon flip link" data-content="This is a different transition"></i>
  133. <br><br>
  134. <div class="code" data-demo="true" data-title="Vertical Flip">
  135. $('.flip.icon')
  136. .popup('setting', 'transition', 'vertical flip')
  137. .popup('toggle')
  138. ;
  139. </div>
  140. </div>
  141. <h2 class="ui header">Settings</h2>
  142. <table class="ui red celled table segment">
  143. <thead>
  144. <th colspan="3">Content</th>
  145. </thead>
  146. <tbody>
  147. <tr>
  148. <td colspan="2">content</td>
  149. <td>Content to display</td>
  150. </tr>
  151. <tr>
  152. <td colspan="2">title</td>
  153. <td>Title to display alongside content</td>
  154. </tr>
  155. <tr>
  156. <td colspan="2">html</td>
  157. <td>HTML content to display instead of preformatted title and content</td>
  158. </tr>
  159. </tbody>
  160. </table>
  161. <table class="ui green celled table segment">
  162. <thead>
  163. <th colspan="3">Popup Settings</th>
  164. </thead>
  165. <tbody>
  166. <tr>
  167. <td>inline</td>
  168. <td>true</td>
  169. <td>If a popup is inline it will be created next to current element, allowing for local css rules to apply. It will not be removed from the DOM after being hidden. Otherwise popups will appended to body and removed after being hidden.</td>
  170. </tr>
  171. <tr>
  172. <td>delay</td>
  173. <td>0</td>
  174. <td>Delay in milliseconds before showing a popup when using hover events.</td>
  175. </tr>
  176. <tr>
  177. <td>variation</td>
  178. <td></td>
  179. <td>Popup variation to use, can use multiple variations with a space delimiter</td>
  180. </tr>
  181. <tr>
  182. <td>on</td>
  183. <td>hover</td>
  184. <td>Event used to invoke popup</td>
  185. </tr>
  186. <tr>
  187. <td>clickToClose</td>
  188. <td>true</td>
  189. <td>Whether clicking anywhere outside a popup should close it.</td>
  190. </tr>
  191. <tr>
  192. <td>position</td>
  193. <td>top center</td>
  194. <td>Position that the popup should appear</td>
  195. </tr>
  196. <tr>
  197. <td>distanceAway</td>
  198. <td>0</td>
  199. <td>Distance away from element for the popup to appear.</td>
  200. </tr>
  201. <tr>
  202. <td>arrowOffset</td>
  203. <td>0</td>
  204. <td>Offset to apply to arrow positioning of element</td>
  205. </tr>
  206. <tr>
  207. <td>maxSearchDepth</td>
  208. <td>10</td>
  209. <td>Number of iterations before giving up search for popup position when a popup cannot fit on screen</td>
  210. </tr>
  211. </tbody>
  212. </table>
  213. <table class="ui blue celled table segment">
  214. <thead>
  215. <th colspan="3">Animation</th>
  216. </thead>
  217. <tbody>
  218. <tr>
  219. <td>transition</td>
  220. <td>scale</td>
  221. <td>transition to use if transition module is included</td>
  222. </tr>
  223. <tr>
  224. <td>duration</td>
  225. <td>250</td>
  226. <td>Duration of popup animation.</td>
  227. </tr>
  228. <tr>
  229. <td>easing</td>
  230. <td>easeOutQuint</td>
  231. <td>Easing equation for popup animation</td>
  232. </tr>
  233. </tbody>
  234. </table>
  235. <table class="ui teal celled table segment">
  236. <thead>
  237. <th colspan="3">Callbacks</th>
  238. </thead>
  239. <tbody>
  240. <tr>
  241. <td>onCreate</td>
  242. <td>None</td>
  243. <td>Callback after a popup html is generated.</td>
  244. </tr>
  245. <tr>
  246. <td>onShow</td>
  247. <td>None</td>
  248. <td>Callback after a popup section is shown.</td>
  249. </tr>
  250. <tr>
  251. <td>onHide</td>
  252. <td>None</td>
  253. <td>Callback after a popup section is hidden.</td>
  254. </tr>
  255. </tbody>
  256. </table>
  257. <table class="ui blue celled table segment">
  258. <thead>
  259. <th colspan="3">UI Module Settings</th>
  260. </thead>
  261. <tbody>
  262. <tr>
  263. <td>Name</td>
  264. <td>Popup</td>
  265. <td>Name used in debug logs</td>
  266. </tr>
  267. <tr>
  268. <td>debug</td>
  269. <td>True</td>
  270. <td>Provides standard debug output to console</td>
  271. </tr>
  272. <tr>
  273. <td>performance</td>
  274. <td>False</td>
  275. <td>Provides performance output to console</td>
  276. </tr>
  277. <tr>
  278. <td>verbose</td>
  279. <td>False</td>
  280. <td>Provides ancillary debug output to console</td>
  281. </tr>
  282. <tr>
  283. <td>namespace</td>
  284. <td>popup</td>
  285. <td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td>
  286. </tr>
  287. <tr>
  288. <td>errors</td>
  289. <td colspan="2">
  290. <div class="code">
  291. errors : {
  292. method : 'The method you called is not defined.'
  293. }
  294. </div>
  295. </td>
  296. </tr>
  297. </tbody>
  298. </table>
  299. </div>
  300. </body>
  301. </html>