index.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  6. <link rel="icon" href="http://fian.my.id/static/favicon.png" />
  7. <meta name="msapplication-tap-highlight" content="no"/>
  8. <title>Waves</title>
  9. <meta name="description" content="Waves - Click effect inspired by Google's Material Design" />
  10. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  11. <link href='http://fonts.googleapis.com/css?family=Roboto:400,300' rel='stylesheet' type='text/css'>
  12. <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
  13. <link rel="stylesheet" type="text/css" href="./static/prims.css">
  14. <link rel="stylesheet" type="text/css" href="./static/snarl.min.css">
  15. <link rel="stylesheet" type="text/css" href="./static/waves.min.css">
  16. <link rel="stylesheet" type="text/css" href="./static/style.css">
  17. <script>
  18. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  19. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  20. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  21. })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  22. ga('create', 'UA-36521756-2', 'auto');
  23. ga('send', 'pageview');
  24. </script>
  25. </head>
  26. <body>
  27. <div id="bg-pattern" class="bg-pattern waves-effect waves-block waves-light"></div>
  28. <div id="navigation" class="shadow">
  29. <a href="#examples">Examples</a>
  30. <a href="#start">Docs</a>
  31. <a href="#api">API</a>
  32. <a href="#faq">FAQ</a>
  33. </div>
  34. <div id="landing" class="section hide">
  35. <h1>Waves</h1>
  36. <p>Click effect inspired by Google's Material Design</p>
  37. <p>v0.6.6</p>
  38. <div class="button">
  39. <a href="#examples" class="waves-effect waves-button waves-float">See the examples</a>
  40. <br>
  41. <span>Hint: click button or background</span>
  42. </div>
  43. </div>
  44. <div id="example" class="section page hide">
  45. <h1>Examples</h1>
  46. <div id="box-button" class="box shadow">
  47. <h2>Buttons</h2>
  48. <a class="top-button" title="Show Source" data-code="button">
  49. <i class="fa fa-code"></i>
  50. </a>
  51. <p class="text-center">
  52. <a class="waves-effect waves-button waves-classic">Button A</a>
  53. <button class="waves-effect waves-button">Button B</button>
  54. <input class="waves-effect waves-button" type="submit" value="Button C">
  55. </p>
  56. <p class="text-center">
  57. <a class="waves-effect waves-button waves-float waves-classic" style="background: #01BCFF;color:#fff">Button A</a>
  58. <button class="waves-effect waves-button waves-light waves-float" style="background: #1bb556;color: #fff;">Button B</button>
  59. <input class="waves-effect waves-button waves-float" style="background: #ff4f0f;color:#fff" type="submit" value="Button C">
  60. </p>
  61. </div>
  62. <div id="box-icon" class="box shadow">
  63. <h2>Icons</h2>
  64. <a class="top-button" title="Show Source" data-code="icon">
  65. <i class="fa fa-code"></i>
  66. </a>
  67. <p class="text-center">
  68. <i class="fa fa-bars waves-effect waves-circle waves-classic"></i>
  69. <i class="fa fa-bookmark waves-effect waves-circle waves-classic"></i>
  70. <i class="fa fa-calendar waves-effect waves-circle"></i>
  71. <i class="fa fa-envelope waves-effect waves-circle"></i>
  72. <i class="fa fa-exclamation waves-effect waves-circle"></i>
  73. <i class="fa fa-folder waves-effect waves-circle"></i>
  74. </p>
  75. <p class="text-center">
  76. <i class="fa fa-bars waves-effect waves-circle waves-classic" style="background: #ff6400;color:#fff;"></i>
  77. <i class="fa fa-bookmark waves-effect waves-circle waves-light waves-classic" style="background: #d54f38;color:#fff;"></i>
  78. <i class="fa fa-calendar waves-effect waves-circle" style="background: #eb4d7e;color:#fff;"></i>
  79. <i class="fa fa-envelope waves-effect waves-circle waves-light" style="background: #d138c8;color:#fff;"></i>
  80. <i class="fa fa-exclamation waves-effect waves-circle" style="background: #bd73ff;color:#fff;"></i>
  81. <i class="fa fa-folder waves-effect waves-circle waves-light" style="background: #0074d6;color:#fff;"></i>
  82. </p>
  83. </div>
  84. <div id="box-other" class="box shadow">
  85. <h2>DIVs &amp; Images</h2>
  86. <a class="top-button" title="Show Source" data-code="other">
  87. <i class="fa fa-code"></i>
  88. </a>
  89. <div class="boxes flat-box waves-effect waves-block waves-classic">Flat Box</div>
  90. <div class="boxes float-box waves-effect waves-float waves-block">Float Box</div>
  91. <div class="clear"></div>
  92. <p class="text-center">
  93. <span class="waves-effect">
  94. <img src="https://farm2.staticflickr.com/1297/1091511802_2fb2451ecc_n.jpg">
  95. </span>
  96. </p>
  97. <p class="text-center">
  98. Image Source: <a href="https://www.flickr.com/photos/aigle_dore/5238554034/" target="_blank">&copy; Moyan Brenn. Flickr</a>
  99. </p>
  100. </div>
  101. <div id="box-action" class="box shadow">
  102. <h2>Action/Event</h2>
  103. <a class="top-button" title="Show Source" data-code="action">
  104. <i class="fa fa-code"></i>
  105. </a>
  106. <p>Works fully with jQuery and JavaScript click event handlers, like <a href="http://hoxxep.github.io/Snarl" target="_blank">Snarl</a></p>
  107. <p class="text-center"><button id="snarl-demo" class="waves-effect waves-button waves-float" style="background:#04d654;color: #fff;">Click Me!</button></p>
  108. </div>
  109. </div>
  110. <div id="source-code" class="hide">
  111. <div class="bg"></div>
  112. <div class="box shadow">
  113. <a title="Close" class="top-button"><i class="fa fa-times"></i></a>
  114. <div id="code-button" class="hide code">
  115. <h2>Buttons</h2>
  116. <div class="wrapper">
  117. {{#code class="lang-markup"}}
  118. <p class="text-center">
  119. <a class="waves-effect waves-button waves-classic">Button A</a>
  120. <button class="waves-effect waves-button">Button B</button>
  121. <input class="waves-effect waves-button" type="submit" value="Button C">
  122. </p>
  123. <p class="text-center">
  124. <a class="waves-effect waves-button waves-float waves-classic" style="background: #01BCFF;color:#fff">Button A</a>
  125. <button class="waves-effect waves-button waves-light waves-float" style="background: #1bb556;color: #fff;">Button B</button>
  126. <input class="waves-effect waves-button waves-float" style="background: #ff4f0f;color:#fff" type="submit" value="Button C">
  127. </p>
  128. {{/code}}
  129. </div>
  130. </div>
  131. <div id="code-icon" class="hide code">
  132. <h2>Icons</h2>
  133. <div class="wrapper">
  134. {{#code class="lang-markup"}}
  135. <p class="text-center">
  136. <i class="fa fa-bars waves-effect waves-circle waves-classic"></i>
  137. <i class="fa fa-bookmark waves-effect waves-circle waves-classic"></i>
  138. <i class="fa fa-calendar waves-effect waves-circle"></i>
  139. <i class="fa fa-envelope waves-effect waves-circle"></i>
  140. <i class="fa fa-exclamation waves-effect waves-circle"></i>
  141. <i class="fa fa-folder waves-effect waves-circle"></i>
  142. </p>
  143. <p class="text-center">
  144. <i class="fa fa-bars waves-effect waves-circle waves-classic" style="background: #ff6400;color:#fff;"></i>
  145. <i class="fa fa-bookmark waves-effect waves-circle waves-light waves-classic" style="background: #d54f38;color:#fff;"></i>
  146. <i class="fa fa-calendar waves-effect waves-circle" style="background: #eb4d7e;color:#fff;"></i>
  147. <i class="fa fa-envelope waves-effect waves-circle waves-light" style="background: #d138c8;color:#fff;"></i>
  148. <i class="fa fa-exclamation waves-effect waves-circle" style="background: #bd73ff;color:#fff;"></i>
  149. <i class="fa fa-folder waves-effect waves-circle waves-light" style="background: #0074d6;color:#fff;"></i>
  150. </p>
  151. {{/code}}
  152. </div>
  153. </div>
  154. <div id="code-other" class="hide code">
  155. <h2>DIVs &amp; Images</h2>
  156. <div class="wrapper">
  157. {{#code class="lang-markup"}}
  158. <div class="boxes flat-box waves-effect waves-block waves-classic">Flat Box</div>
  159. <div class="boxes float-box waves-effect waves-float waves-block">Float Box</div>
  160. <div class="clear"></div>
  161. <p class="text-center">
  162. <span class="waves-effect">
  163. <img src="https://farm2.staticflickr.com/1297/1091511802_2fb2451ecc_n.jpg">
  164. </span>
  165. </p>
  166. {{/code}}
  167. </div>
  168. </div>
  169. <div id="code-action" class="hide code">
  170. <h2>Action/Event</h2>
  171. <div class="wrapper">
  172. {{#code class="lang-markup"}}
  173. <p class="text-center">
  174. <button id="snarl-demo" class="waves-effect waves-button waves-float" style="background:#04d654;color: #fff;">Click Me!</button>
  175. </p>
  176. <script type="text/javascript">
  177. Snarl.setDefaultOptions({
  178. timeout: 5000
  179. });
  180. $('#snarl-demo').click(function() {
  181. Snarl.addNotification({
  182. title: 'Snarl Notification',
  183. text: 'You clicked the Waves button!'
  184. });
  185. });
  186. </script>
  187. {{/code}}
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. <div id="getting-started" class="content section page hide">
  193. <h1>Getting Started</h1>
  194. <div class="box shadow">
  195. <p>
  196. It's easy to use Waves. Download the latest version of Waves from <a href="https://github.com/publicis-indonesia/Waves/releases">Github repository</a>. Just include waves.min.css and waves.min.js to your HTML file. And Waves is ready to use!
  197. </p>
  198. {{#code class="lang-markup"}}
  199. <!DOCTYPE html>
  200. <html>
  201. <head>
  202. <title>Waves example</title>
  203. <link rel="stylesheet" type="text/css" href="/path/to/waves.min.css" />
  204. </head>
  205. <body>
  206. <a href="#" class="waves-effect waves-button">Click Here</a>
  207. <script type="text/javascript" src="/path/to/waves.min.js"></script>
  208. <script type="text/javascript">
  209. Waves.displayEffect();
  210. </script>
  211. </body>
  212. </html>
  213. {{/code}}
  214. <p>
  215. <strong>Advanced:</strong> <br>
  216. Waves also provide LESS, SCSS, and SASS source. So, feel free to used it :)
  217. </p>
  218. <p>
  219. To put Waves effect on your buttons, just add <code class="language-css">.waves-effect</code> and <code class="language-css">.waves-button</code> class to your buttons.
  220. </p>
  221. {{#code class="lang-markup"}}
  222. <button class="waves-effect waves-button">Click Here</button>
  223. <!-- It also support a, input submit and input button tag -->
  224. <a href="#" class="waves-effect waves-button">A Tag</a>
  225. <input type="submit" class="waves-effect waves-button" value="Input Submit">
  226. <input type="button" class="waves-effect waves-button" value="Input Button">
  227. {{/code}}
  228. <p>
  229. Normally, the effect will not work on single tag element like <code class="language-markup">&lt;input&gt;</code>. That's why Waves will wrap <code class="language-markup">&lt;input&gt;</code> inside <code class="language-markup">&lt;i&gt;</code> automatically if you display the effect.
  230. </p>
  231. {{#code class="lang-markup"}}
  232. <!-- Before displaying the effect -->
  233. <input class="waves-button-input" type="submit" value="Button C">
  234. <!-- After displaying the effect -->
  235. <i class="waves-effect waves-button waves-input-wrapper" style="width:85px;height:36px;">
  236. <input class="waves-button-input" type="submit" value="Button C">
  237. </i>
  238. {{/code}}
  239. <p>
  240. Waves can also be applied with icons (like FontAwesome) by using <code class="language-css">waves-circle</code>, so you can give the icons Waves effect. It's simple, just give additional <code class="language-css">.waves-effect</code> and <code class="language-css">.waves-circle</code> class to your <code class="language-markup">&lt;i&gt;</code> tags and Waves will wrap icon inside circle spot that will prevent Waves effect spreading.
  241. </p>
  242. {{#code class="lang-markup"}}
  243. <i class="fa fa-gear waves-effect waves-circle"></i>
  244. {{/code}}
  245. <p>
  246. You can also give Waves effect to other element tag like <code class="language-markup">&lt;div&gt;</code> or <code class="language-markup">&lt;img&gt;</code>. All you need to do is just put <code class="language-css">.waves-effect</code> class. For element that not have closing tag like <code class="language-markup">&lt;img&gt;</code>, you have to wrap it inside <code class="language-markup">&lt;span&gt;</code>, and for element that have blocky display like <code class="language-markup">&lt;div&gt;</code>, you need to put <code class="language-css">.waves-block</code> class to keep its shape.
  247. </p>
  248. {{#code class="lang-markup"}}
  249. <!-- For single tag element -->
  250. <span class="waves-effect">
  251. <img src="/path/to/images.jpg">
  252. </span>
  253. <!-- For blocky display to keep its shape -->
  254. <div class="waves-effect waves-block">
  255. Block A
  256. </div>
  257. {{/code}}
  258. <h2>Styling</h2>
  259. <p>
  260. Waves give you capabilities to color your <code class="language-css">.waves-effect</code>. You can do this by set up the color and background-color/background properties on your element style (or CSS file).
  261. </p>
  262. {{#code class="lang-markup"}}
  263. <!-- Put color in inline style -->
  264. <span class="waves-effect waves-button" style="background: #01BCFF;color: #fff;">
  265. <button>Button B</button>
  266. </span>
  267. <!-- Put color inside style tag or css file -->
  268. <style>
  269. .blue-button {
  270. background: #01BCFF;
  271. color: #FFF;
  272. }
  273. </style>
  274. <span class="waves-effect waves-button blue-button">
  275. <button>Button B</button>
  276. </span>
  277. {{/code}}
  278. <p>
  279. By default, Waves ripple is darker. If you want the ripple is lighter, you can set <code class="language-css">.waves-light</code> along side <code class="language-css">.waves-effect</code> class. Make sure the element has been colored, because if it haven't colored yet, you cannot see the light ripple.
  280. </p>
  281. {{#code class="lang-markup"}}
  282. <style>
  283. .blue-button {
  284. background: #01BCFF;
  285. color: #FFF;
  286. }
  287. </style>
  288. <span class="waves-effect waves-button waves-light blue-button">
  289. <button>Button B</button>
  290. </span>
  291. {{/code}}
  292. <p>
  293. Not only give your "Waves effect", Waves also provide float effect when you click an element
  294. by adding <code class="language-css">.waves-float</code> class to the element. Once again, before put float effect, your have to make sure the element has been colored, to prevent weird shadow on the element.
  295. </p>
  296. {{#code class="lang-markup"}}
  297. <style>
  298. .blue-button {
  299. background: #01BCFF;
  300. color: #FFF;
  301. }
  302. </style>
  303. <span class="waves-effect waves-button waves-float blue-button">
  304. <button>Button B</button>
  305. </span>
  306. {{/code}}
  307. <h2>Quick Fix</h2>
  308. <p>
  309. <strong>IE Tap highlight on Windows Phone</strong>
  310. </p>
  311. <p>
  312. By default if you access a web page using IE in Windows Phone, you will get tap highlight
  313. effect when you tapping a link or button and this highlight will shadowed Waves effect. To prevent this thing happen, you will need to add <code>msapplication-tap-highlight</code> meta tag on your header.
  314. </p>
  315. {{#code class="lang-markup"}}
  316. <!DOCTYPE html>
  317. <html>
  318. <head>
  319. <!-- Remove Tap Highlight on Windows Phone IE -->
  320. <meta name="msapplication-tap-highlight" content="no"/>
  321. <title>Your Web Page</title>
  322. <link rel="stylesheet" type="text/css" href="/path/to/waves.css" />
  323. </head>
  324. <body>
  325. <script type="text/javascript" src="/path/to/waves.js">\</script\>
  326. <script type="text/javascript">
  327. Waves.displayEffect();
  328. </script>
  329. </body>
  330. </html>
  331. {{/code}}
  332. </div>
  333. </div>
  334. <div id="api" class="content section page hide">
  335. <h1>API</h1>
  336. <div class="box shadow">
  337. <h3 class="code-head">displayEffect(config)</h3>
  338. <p>
  339. <strong>Arguments</strong>
  340. </p>
  341. <ul>
  342. <li><span class="code">config</span> - (optional) Configuration object for displaying Waves effect.</li>
  343. </ul>
  344. {{#code class="lang-javascript"}}
  345. {
  346. // How long Waves effect duration
  347. // when its clicked (in milisecond)
  348. duration: 500
  349. }
  350. {{/code}}
  351. </div>
  352. </div>
  353. <div id="faq" class="content section page hide">
  354. <h1>FAQ</h1>
  355. <div class="box shadow">
  356. <p>
  357. <strong>Browser support?</strong>
  358. </p>
  359. <ul>
  360. <li>IE 10++</li>
  361. <li>Chrome 14++</li>
  362. <li>Firefox 9++</li>
  363. <li>Safari 5.1++</li>
  364. <li>Opera 11.6++</li>
  365. <li>iOS 6++ (Safari)</li>
  366. <li>Windows Phone 8.1 (IE)</li>
  367. <li>Android Browser 4++</li>
  368. </ul>
  369. <p>
  370. <strong>Can I make Waves better?</strong>
  371. </p>
  372. <p>
  373. Yes, I strongly encourage you to contribute to make Waves better. So, if you find a bug, or have nice idea for Waves development, please <a href="https://github.com/fians/Waves/issues" target="_blank">mention me</a>.
  374. </p>
  375. </div>
  376. </div>
  377. <script type="text/javascript" src="./static/prims.js"></script>
  378. <script type="text/javascript" src="./static/snarl.min.js"></script>
  379. <script type="text/javascript" src="./static/waves.min.js"></script>
  380. <script type="text/javascript" src="./static/jquery.js"></script>
  381. <script type="text/javascript">
  382. var currentRoute = false;
  383. function enterTransition(name, callback) {
  384. var element = $('#'+name);
  385. element.removeClass('hide');
  386. setTimeout(function() {
  387. element.addClass('show')
  388. .addClass('appear');
  389. setTimeout(function() {
  390. element.addClass('flow');
  391. return callback();
  392. }, 1000);
  393. }, 100);
  394. }
  395. function leaveTransition(name, callback) {
  396. var element = $('#'+name);
  397. element.removeClass('flow')
  398. .removeClass('show');
  399. setTimeout(function() {
  400. element.removeClass('appear');
  401. setTimeout(function() {
  402. element.addClass('hide');
  403. return callback();
  404. }, 500);
  405. }, 300);
  406. }
  407. var routes = {
  408. // Landing Page Animation
  409. index: {
  410. enter: function(callback) {
  411. $('#landing').removeClass('hide');
  412. setTimeout(function() {
  413. $('#landing').addClass('show');
  414. return callback();
  415. }, 100);
  416. },
  417. leave: function(callback) {
  418. $('#landing').removeClass('show');
  419. setTimeout(function() {
  420. $('#landing').addClass('hide');
  421. return callback();
  422. }, 500);
  423. }
  424. },
  425. // Example Page Animation
  426. examples: {
  427. enter: function(callback) {
  428. enterTransition('example', callback);
  429. },
  430. leave: function(callback) {
  431. leaveTransition('example', callback);
  432. }
  433. },
  434. // Getting Started Page Animation
  435. start: {
  436. enter: function(callback) {
  437. enterTransition('getting-started', callback);
  438. },
  439. leave: function(callback) {
  440. leaveTransition('getting-started', callback);
  441. }
  442. },
  443. // API Page Animation
  444. api: {
  445. enter: function(callback) {
  446. enterTransition('api', callback);
  447. },
  448. leave: function(callback) {
  449. leaveTransition('api', callback);
  450. }
  451. },
  452. // FAQ Page Animation
  453. faq: {
  454. enter: function(callback) {
  455. enterTransition('faq', callback);
  456. },
  457. leave: function(callback) {
  458. leaveTransition('faq', callback);
  459. }
  460. }
  461. }
  462. function routing() {
  463. var hash = window.location.hash.replace('#', '');
  464. if (!hash.length) {
  465. hash = 'index';
  466. }
  467. if (['index', 'examples', 'start', 'api', 'faq'].indexOf(hash) === -1) {
  468. return false;
  469. }
  470. if (currentRoute === false) {
  471. return routes[hash].enter(function() {
  472. currentRoute = hash;
  473. });
  474. }
  475. return routes[currentRoute].leave(function() {
  476. routes[hash].enter(function() {
  477. currentRoute = hash;
  478. });
  479. });
  480. }
  481. function init() {
  482. setTimeout(function() {
  483. $('#navigation').addClass('show');
  484. routing();
  485. }, 500);
  486. }
  487. $(document).on('ready', function() {
  488. // Init Waves
  489. Waves.displayEffect();
  490. init();
  491. $(window).on('hashchange', routing);
  492. Snarl.setDefaultOptions({
  493. timeout: 5000
  494. });
  495. $('#snarl-demo').click(function() {
  496. Snarl.addNotification({
  497. title: 'Snarl Notification',
  498. text: 'You clicked the Waves button!'
  499. });
  500. });
  501. /**
  502. * Example source code click
  503. */
  504. $('#example .top-button').on('click', function() {
  505. var type = $(this).data('code');
  506. $('#source-code .box .code').addClass('hide');
  507. $('#source-code .box #code-'+type).removeClass('hide');
  508. $('#source-code').removeClass('hide');
  509. setTimeout(function() {
  510. $('#source-code').addClass('show');
  511. }, 50);
  512. });
  513. $('#source-code .top-button').on('click', function() {
  514. $('#source-code').removeClass('show');
  515. setTimeout(function() {
  516. $('#source-code .box .code').addClass('hide');
  517. $('#source-code').addClass('hide');
  518. }, 500);
  519. });
  520. });
  521. </script>
  522. </body>
  523. </html>