项目作者: luhaopeng

项目描述 :
A collection of components for 404 pages. No dependencies.
高级语言: JavaScript
项目地址: git://github.com/luhaopeng/page-not-found.git
创建时间: 2019-05-23T08:53:07Z
项目社区:https://github.com/luhaopeng/page-not-found

开源协议:Other

下载


page-not-found

996.icu
LICENSE
GitHub license

A collection of components for 404 pages. No dependencies.

Quick Start

  1. Include pnf.min.js in your page.
  1. <script src="pnf.min.js"></script>
  1. Choose your container.
  1. <div class="pnf-container"></div>
  1. Initialize with PnF.
    1. PnF.fragment('.pnf-container')

API

.fragment(selector, options)

Demo

options

Option Type Default Description
homeUrl string null Url to homepage.
homeLabel string 'Home' Label text for link button.
maxRotate number 120 Fragment rotation. Will rotate between -maxRotate / 2 to maxRotate / 2.
layers [layer] miscellaneous Layer objects array. See below.

layer

Option Type Default Description
offset number miscellaneous The intensity of layer translation. A negative offset produces reverse translation.
fragments [string] \ number miscellaneous Fragment strings array or fragment count.
color color string miscellaneous Background colors for fragments.

Styling

Generated HTML markup is displayed below. You may style it any way you’d like.

  1. <div class="fragment-container">
  2. <a class="fragment-home">...</a>
  3. <div class="fragment-layer-1">
  4. <div class="fragment"></div>
  5. <div class="fragment"></div>
  6. </div>
  7. <div class="fragment-layer-2">
  8. <div class="fragment"></div>
  9. <div class="fragment"></div>
  10. </div>
  11. <div class="fragment-layer-3">
  12. <div class="fragment"></div>
  13. <div class="fragment"></div>
  14. </div>
  15. </div>

Style sample:

  1. body {
  2. margin: 0;
  3. }
  4. .fragment-container {
  5. width: 100vw;
  6. height: 100vh;
  7. overflow: hidden;
  8. position: relative;
  9. }
  10. .fragment-container div[class*="fragment-layer-"] {
  11. position: absolute;
  12. top: 0;
  13. left: 0;
  14. right: 0;
  15. bottom: 0;
  16. transition: 0.1s;
  17. }
  18. .fragment-container .fragment-home {
  19. color: #fff;
  20. border-radius: 4px;
  21. border: none;
  22. outline: 0;
  23. box-shadow: 0px 0px 16px 0px rgba(24, 144, 255, 0.3);
  24. background-color: rgba(24, 144, 255, 0.6);
  25. padding: 12px 20px;
  26. font-size: 20px;
  27. cursor: pointer;
  28. margin: 50vh auto 0;
  29. display: block;
  30. width: max-content;
  31. text-decoration: none;
  32. position: relative;
  33. transition: linear 0.2s;
  34. }
  35. .fragment-container .fragment-home:hover {
  36. box-shadow: 0px 0px 16px 0px rgba(24, 144, 255, 0.7);
  37. background-color: rgba(24, 144, 255, 0.95);
  38. }
  39. .fragment-container .fragment-layer-1 .fragment {
  40. text-align: center;
  41. line-height: 1.5;
  42. padding: 5px 10px;
  43. font-size: 18px;
  44. color: #fff;
  45. }
  46. .fragment-container .fragment-layer-2 .fragment {
  47. width: 20px;
  48. height: 20px;
  49. }
  50. .fragment-container .fragment-layer-3 .fragment {
  51. width: 10px;
  52. height: 10px;
  53. }

TODO

  • Locate text layer fragments from left to right. Currently it’s totally random.

LICENSE

  1. Under the MIT License. See the LICENSE file for details.
  2. Under the Anti 996 License. See the Anti 996 LICENSE file for details.