HTML如下:
1 <div class="container">
3 <!--特效1 -->
4 <section id="set-1">
5 <div class="hi-icon-wrap hi-icon-effect-1 hi-icon-effect-1a">
6 <a href="#set-1" class="hi-icon hi-icon-archive">Archive</a>
7 <a href="#set-1" class="hi-icon hi-icon-chat">Chat</a>
8 <a href="#set-1" class="hi-icon hi-icon-bookmark">Bookmarks</a>
9 <a href="#set-1" class="hi-icon hi-icon-user">User</a>
10 <a href="#set-1" class="hi-icon hi-icon-contract">Contact</a>
11 </div>
12 <div class="hi-icon-wrap hi-icon-effect-1 hi-icon-effect-1b">
13 <a href="#set-1" class="hi-icon hi-icon-archive">Archive</a>
14 <a href="#set-1" class="hi-icon hi-icon-chat">Chat</a>
15 <a href="#set-1" class="hi-icon hi-icon-bookmark">Bookmarks</a>
16 <a href="#set-1" class="hi-icon hi-icon-user">User</a>
17 <a href="#set-1" class="hi-icon hi-icon-contract">Contact</a>
18 </div>
19
20 <!--特效2 -->
21 </section>
22 <section id="set-2">
23 <div class="hi-icon-wrap hi-icon-effect-2 hi-icon-effect-2a">
24 <a href="#set-2" class="hi-icon hi-icon-mobile">Mobile</a>
25 <a href="#set-2" class="hi-icon hi-icon-screen">Desktop</a>
26 <a href="#set-2" class="hi-icon hi-icon-earth">Partners</a>
27 <a href="#set-2" class="hi-icon hi-icon-support">Support</a>
28 <a href="#set-2" class="hi-icon hi-icon-locked">Security</a>
29 </div>
30 <div class="hi-icon-wrap hi-icon-effect-2 hi-icon-effect-2b">
31 <a href="#set-2" class="hi-icon hi-icon-mobile">Mobile</a>
32 <a href="#set-2" class="hi-icon hi-icon-screen">Desktop</a>
33 <a href="#set-2" class="hi-icon hi-icon-earth">Partners</a>
34 <a href="#set-2" class="hi-icon hi-icon-support">Support</a>
35 <a href="#set-2" class="hi-icon hi-icon-locked">Security</a>
36 </div>
37 <div class="hi-icon-wrap hi-icon-effect-2 hi-icon-effect-2c">
38 <a href="#set-2" class="hi-icon hi-icon-mobile">Mobile</a>
39 <a href="#set-2" class="hi-icon hi-icon-screen">Desktop</a>
40 <a href="#set-2" class="hi-icon hi-icon-earth">Partners</a>
41 <a href="#set-2" class="hi-icon hi-icon-support">Support</a>
42 <a href="#set-2" class="hi-icon hi-icon-locked">Security</a>
43 </div>
44 <div class="hi-icon-wrap hi-icon-effect-2 hi-icon-effect-2d">
45 <a href="#set-2" class="hi-icon hi-icon-mobile">Mobile</a>
46 <a href="#set-2" class="hi-icon hi-icon-screen">Desktop</a>
47 <a href="#set-2" class="hi-icon hi-icon-earth">Partners</a>
48 <a href="#set-2" class="hi-icon hi-icon-support">Support</a>
49 <a href="#set-2" class="hi-icon hi-icon-locked">Security</a>
50 </div>
51 </section>
52
53 <!--特效3 -->
54 <section id="set-3">
55 <div class="hi-icon-wrap hi-icon-effect-3">
56 <a href="#set-3" class="hi-icon hi-icon-cog">Settings</a>
57 <a href="#set-3" class="hi-icon hi-icon-support">Support</a>
58 <a href="#set-3" class="hi-icon hi-icon-star">Fav</a>
59 <a href="#set-3" class="hi-icon hi-icon-contract">Contract</a>
60 <a href="#set-3" class="hi-icon hi-icon-refresh">Refresh</a>
61 </div>
62 </section>
63
64 <!--特效4-->
65 <section id="set-4">
66 <div class="hi-icon-wrap hi-icon-effect-4 hi-icon-effect-4a">
67 <a href="#set-4" class="hi-icon hi-icon-cog">Settings</a>
68 <a href="#set-4" class="hi-icon hi-icon-clock">Time</a>
69 <a href="#set-4" class="hi-icon hi-icon-videos">Videos</a>
70 <a href="#set-4" class="hi-icon hi-icon-list">List</a>
71 <a href="#set-4" class="hi-icon hi-icon-refresh">Refresh</a>
72 </div>
73 <div class="hi-icon-wrap hi-icon-effect-4 hi-icon-effect-4b">
74 <a href="#set-4" class="hi-icon hi-icon-cog">Settings</a>
75 <a href="#set-4" class="hi-icon hi-icon-clock">Time</a>
76 <a href="#set-4" class="hi-icon hi-icon-videos">Videos</a>
77 <a href="#set-4" class="hi-icon hi-icon-list">List</a>
78 <a href="#set-4" class="hi-icon hi-icon-refresh">Refresh</a>
79 </div>
80 </section>
81
82 <!--特效5-->
83 <section id="set-5">
84 <div class="hi-icon-wrap hi-icon-effect-5">
85 <a href="#set-5" class="hi-icon hi-icon-archive">Archive</a>
86 <a href="#set-5" class="hi-icon hi-icon-chat">Chat</a>
87 <a href="#set-5" class="hi-icon hi-icon-bookmark">Bookmarks</a>
88 <a href="#set-5" class="hi-icon hi-icon-user">User</a>
89 <a href="#set-5" class="hi-icon hi-icon-contract">Contact</a>
90 </div>
91 </section>
92
93 <!--特效6-->
94 <section id="set-6">
95 <div class="hi-icon-wrap hi-icon-effect-6 hi-icon-effect-6a">
96 <a href="#set-6" class="hi-icon hi-icon-images">Images</a>
97 <a href="#set-6" class="hi-icon hi-icon-pencil">Edit</a>
98 <a href="#set-6" class="hi-icon hi-icon-link">Link</a>
99 <a href="#set-6" class="hi-icon hi-icon-mail">Mail</a>
100 <a href="#set-6" class="hi-icon hi-icon-location">Location</a>
101 </div>
102 <div class="hi-icon-wrap hi-icon-effect-6 hi-icon-effect-6b">
103 <a href="#set-6" class="hi-icon hi-icon-images">Images</a>
104 <a href="#set-6" class="hi-icon hi-icon-pencil">Edit</a>
105 <a href="#set-6" class="hi-icon hi-icon-link">Link</a>
106 <a href="#set-6" class="hi-icon hi-icon-mail">Mail</a>
107 <a href="#set-6" class="hi-icon hi-icon-location">Location</a>
108 </div>
109 </section>
110 </div>
CSS 如下
.container { height: 100%; position: relative; } .container > section { min-height: 100%; margin: 0 auto; padding: 20em 3em; } .touch .container > section { padding: 0; min-height: 0; } .container > header { margin: 0 auto; padding: 2em 1em 2em; position: fixed; top: 0; left: 0; width: 100%; text-align: center; background: #fff; z-index: 999999; -webkit-backface-visibility: hidden; } .touch .container > header { position: relative; } .container > header h1 { font-size: 2.625em; line-height: 1.3; margin: 0; font-weight: 300; } .container > header span { display: block; font-size: 60%; opacity: 0.6; padding: 0 0 0.6em 0.1em; } .container > section p { color: #fff; text-align: center; padding: 1em; margin: 0; } /* To Navigation Style */ .codrops-top { background: #fff; background: rgba(255, 255, 255, 0.6); text-transform: uppercase; width: 100%; font-size: 0.69em; line-height: 2.2; position: fixed; top: 0; left: 0; width: 100%; z-index: 9999999; } .codrops-top a { padding: 0 1em; letter-spacing: 0.1em; display: inline-block; } .codrops-top a:hover { background: rgba(255,255,255,0.95); color: #777; } .codrops-top span.right { float: right; } .codrops-top span.right a { float: left; display: block; } .codrops-icon:before { font-family: 'codropsicons'; margin: 0 4px; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1; -webkit-font-smoothing: antialiased; } .codrops-icon-drop:before { content: "e001"; } .codrops-icon-prev:before { content: "e004"; } .codrops-icon-archive:before { content: "e002"; } .codrops-icon-next:before { content: "e000"; } .codrops-icon-about:before { content: "e003"; } /* Demo Buttons Style */ .codrops-demos { padding-top: 1em; font-size: 0.9em; } .touch .codrops-demos { display: none; } .codrops-demos a { display: inline-block; margin: 0.5em; padding: 0.6em 1em; border: 3px solid #ddd; font-weight: 700; } .codrops-demos a:hover { opacity: 0.6; } .codrops-demos a.current-demo, .codrops-demos a.current-demo:hover { border: 3px solid #aaa; opacity: 1; color: #aaa; } #set-4 { background: #0e83cd; } #set-5 { background: #702fa8; } #set-6 { background: #64bb5d; } #set-7 { background: #d54f30; } #set-8 { background: #3851bc; } #set-9 { background: #96a94b; } @media screen and (max- 800px) { .hi-icon { margin: 15px !important; } .container > section { padding: 20em 1em; } } @media screen and (max- 25em) { .codrops-icon span { display: none; } }
@font-face { font-family: 'ecoicon'; src: url('../fonts/ecoicons/ecoicon.eot'); src: url('../fonts/ecoicons/ecoicon.eot?#iefix') format('embedded-opentype'), url('../fonts/ecoicons/ecoicon.woff') format('woff'), url('../fonts/ecoicons/ecoicon.ttf') format('truetype'), url('../fonts/ecoicons/ecoicon.svg#ecoicon') format('svg'); font-weight: normal; font-style: normal; } .hi-icon-wrap { text-align: center; margin: 0 auto; padding: 2em 0 3em; } .hi-icon { display: inline-block; font-size: 0px; cursor: pointer; margin: 15px 30px; width: 90px; height: 90px; border-radius: 50%; text-align: center; position: relative; z-index: 1; color: #fff; } .hi-icon:after { pointer-events: none; position: absolute; width: 100%; height: 100%; border-radius: 50%; content: ''; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; } .hi-icon:before { font-family: 'ecoicon'; speak: none; font-size: 48px; line-height: 90px; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; display: block; -webkit-font-smoothing: antialiased; } .hi-icon-mobile:before { content: "e009"; } .hi-icon-screen:before { content: "e00a"; } .hi-icon-earth:before { content: "e002"; } .hi-icon-support:before { content: "e000"; } .hi-icon-locked:before { content: "e001"; } .hi-icon-cog:before { content: "e003"; } .hi-icon-clock:before { content: "e004"; } .hi-icon-videos:before { content: "e005"; } .hi-icon-list:before { content: "e006"; } .hi-icon-refresh:before { content: "e007"; } .hi-icon-images:before { content: "e008"; } .hi-icon-pencil:before { content: "e00b"; } .hi-icon-link:before { content: "e00c"; } .hi-icon-mail:before { content: "e00d"; } .hi-icon-location:before { content: "e00e"; } .hi-icon-archive:before { content: "e00f"; } .hi-icon-chat:before { content: "e010"; } .hi-icon-bookmark:before { content: "e011"; } .hi-icon-user:before { content: "e012"; } .hi-icon-contract:before { content: "e013"; } .hi-icon-star:before { content: "e014"; } /*特效1*/ .hi-icon-effect-4 .hi-icon { width: 92px; height: 92px; box-shadow: 0 0 0 4px rgba(255,255,255,1); } .hi-icon-effect-4a .hi-icon { -webkit-transition: box-shadow 0.2s; -moz-transition: box-shadow 0.2s; transition: box-shadow 0.2s; } .hi-icon-effect-4 .hi-icon:before { line-height: 92px; } .hi-icon-effect-4 .hi-icon:after { top: -4px; left: -4px; padding: 0; z-index: 10; border: 4px dashed #fff; } .hi-icon-effect-4 .hi-icon:hover { box-shadow: 0 0 0 0 rgba(255,255,255,0); color: #fff; } /*4b */ .hi-icon-effect-4b .hi-icon:hover { -webkit-transition: box-shadow 0.2s; -moz-transition: box-shadow 0.2s; transition: box-shadow 0.2s; } .hi-icon-effect-4b .hi-icon:hover:after { -webkit-animation: spinAround 9s linear infinite; -moz-animation: spinAround 9s linear infinite; animation: spinAround 9s linear infinite; } @-webkit-keyframes spinAround { from { -webkit-transform: rotate(0deg) } to { -webkit-transform: rotate(360deg); } } @-moz-keyframes spinAround { from { -moz-transform: rotate(0deg) } to { -moz-transform: rotate(360deg); } } @keyframes spinAround { from { transform: rotate(0deg) } to { transform: rotate(360deg); } } /* 特效2 */ .hi-icon-effect-5 .hi-icon { box-shadow: 0 0 0 4px rgba(255,255,255,1); overflow: hidden; -webkit-transition: background 0.3s, color 0.3s, box-shadow 0.3s; -moz-transition: background 0.3s, color 0.3s, box-shadow 0.3s; transition: background 0.3s, color 0.3s, box-shadow 0.3s; } .hi-icon-effect-5 .hi-icon:after { display: none; } .hi-icon-effect-5 .hi-icon:hover { background: rgba(255,255,255,1); color: #702fa8; box-shadow: 0 0 0 8px rgba(255,255,255,0.3); } .hi-icon-effect-5a .hi-icon:hover:before { -webkit-animation: toRightFromLeft 0.3s forwards; -moz-animation: toRightFromLeft 0.3s forwards; animation: toRightFromLeft 0.3s forwards; } @-webkit-keyframes toRightFromLeft { 49% { -webkit-transform: translate(100%); } 50% { opacity: 0; -webkit-transform: translate(-100%); } 51% { opacity: 1; } } @-moz-keyframes toRightFromLeft { 49% { -moz-transform: translate(100%); } 50% { opacity: 0; -moz-transform: translate(-100%); } 51% { opacity: 1; } } @keyframes toRightFromLeft { 49% { transform: translate(100%); } 50% { opacity: 0; transform: translate(-100%); } 51% { opacity: 1; } } .hi-icon-effect-5b .hi-icon:hover:before { -webkit-animation: toLeftFromRight 0.3s forwards; -moz-animation: toLeftFromRight 0.3s forwards; animation: toLeftFromRight 0.3s forwards; } @-webkit-keyframes toLeftFromRight { 49% { -webkit-transform: translate(-100%); } 50% { opacity: 0; -webkit-transform: translate(100%); } 51% { opacity: 1; } } @-moz-keyframes toLeftFromRight { 49% { -moz-transform: translate(-100%); } 50% { opacity: 0; -moz-transform: translate(100%); } 51% { opacity: 1; } } @keyframes toLeftFromRight { 49% { transform: translate(-100%); } 50% { opacity: 0; transform: translate(100%); } 51% { opacity: 1; } } .hi-icon-effect-5c .hi-icon:hover:before { -webkit-animation: toTopFromBottom 0.3s forwards; -moz-animation: toTopFromBottom 0.3s forwards; animation: toTopFromBottom 0.3s forwards; } @-webkit-keyframes toTopFromBottom { 49% { -webkit-transform: translateY(-100%); } 50% { opacity: 0; -webkit-transform: translateY(100%); } 51% { opacity: 1; } } @-moz-keyframes toTopFromBottom { 49% { -moz-transform: translateY(-100%); } 50% { opacity: 0; -moz-transform: translateY(100%); } 51% { opacity: 1; } } @keyframes toTopFromBottom { 49% { transform: translateY(-100%); } 50% { opacity: 0; transform: translateY(100%); } 51% { opacity: 1; } } .hi-icon-effect-5d .hi-icon:hover:before { -webkit-animation: toBottomFromTop 0.3s forwards; -moz-animation: toBottomFromTop 0.3s forwards; animation: toBottomFromTop 0.3s forwards; } @-webkit-keyframes toBottomFromTop { 49% { -webkit-transform: translateY(100%); } 50% { opacity: 0; -webkit-transform: translateY(-100%); } 51% { opacity: 1; } } @-moz-keyframes toBottomFromTop { 49% { -moz-transform: translateY(100%); } 50% { opacity: 0; -moz-transform: translateY(-100%); } 51% { opacity: 1; } } @keyframes toBottomFromTop { 49% { transform: translateY(100%); } 50% { opacity: 0; transform: translateY(-100%); } 51% { opacity: 1; } } /* 特效3 */ .hi-icon-effect-6 .hi-icon { box-shadow: 0 0 0 4px rgba(255,255,255,1); -webkit-transition: background 0.2s, color 0.2s; -moz-transition: background 0.2s, color 0.2s; transition: background 0.2s, color 0.2s; } .hi-icon-effect-6 .hi-icon:hover { background: rgba(255,255,255,1); color: #64bb5d; } .hi-icon-effect-6 .hi-icon:hover:before { -webkit-animation: spinAround 2s linear infinite; -moz-animation: spinAround 2s linear infinite; animation: spinAround 2s linear infinite; } /* 特效4 */ .hi-icon-effect-7 .hi-icon { box-shadow: 0 0 0 4px rgba(255,255,255,1); -webkit-transition: background 0.2s, color 0.2s; -moz-transition: background 0.2s, color 0.2s; transition: background 0.2s, color 0.2s; } .hi-icon-effect-7 .hi-icon:hover { color: #fff; } .hi-icon-effect-7 .hi-icon:after { top: -8px; left: -8px; padding: 8px; z-index: -1; opacity: 0; } /* 7a */ .hi-icon-effect-7a .hi-icon:after { box-shadow: 0 0 0 rgba(255,255,255,1); -webkit-transition: opacity 0.2s, box-shadow 0.2s; -moz-transition: opacity 0.2s, box-shadow 0.2s; transition: opacity 0.2s, box-shadow 0.2s; } .hi-icon-effect-7a .hi-icon:hover:after { opacity: 1; box-shadow: 3px 3px 0 rgba(255,255,255,1); } .hi-icon-effect-7a .hi-icon:before { -webkit-transform: scale(0.8); -moz-transform: scale(0.8); -ms-transform: scale(0.8); transform: scale(0.8); opacity: 0.7; -webkit-transition: -webkit-transform 0.2s, opacity 0.2s; -moz-transition: -moz-transform 0.2s, opacity 0.2s; transition: transform 0.2s, opacity 0.2s; } .hi-icon-effect-7a .hi-icon:hover:before { -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); transform: scale(1); opacity: 1; } /* 7b */ .hi-icon-effect-7b .hi-icon:after { box-shadow: 3px 3px rgba(255,255,255,1); -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -ms-transform: rotate(-90deg); transform: rotate(-90deg); -webkit-transition: opacity 0.2s, -webkit-transform 0.2s; -moz-transition: opacity 0.2s, -moz-transform 0.2s; transition: opacity 0.2s, transform 0.2s; } .hi-icon-effect-7b .hi-icon:hover:after { opacity: 1; -webkit-transform: rotate(0deg); -moz-transform: rotate(0deg); -ms-transform: rotate(0deg); transform: rotate(0deg); } .hi-icon-effect-7b .hi-icon:before { -webkit-transform: scale(0.8); -moz-transform: scale(0.8); -ms-transform: scale(0.8); transform: scale(0.8); opacity: 0.7; -webkit-transition: -webkit-transform 0.2s, opacity 0.2s; -moz-transition: -moz-transform 0.2s, opacity 0.2s; transition: transform 0.2s, opacity 0.2s; } .hi-icon-effect-7b .hi-icon:hover:before { -webkit-transform: scale(1); -moz-transform: scale(1); -ms-transform: scale(1); transform: scale(1); opacity: 1; } /* 特效5 */ .hi-icon-effect-8 .hi-icon { background: rgba(255,255,255,0.1); -webkit-transition: -webkit-transform ease-out 0.1s, background 0.2s; -moz-transition: -moz-transform ease-out 0.1s, background 0.2s; transition: transform ease-out 0.1s, background 0.2s; } .hi-icon-effect-8 .hi-icon:after { top: 0; left: 0; padding: 0; z-index: -1; box-shadow: 0 0 0 2px rgba(255,255,255,0.1); opacity: 0; -webkit-transform: scale(0.9); -moz-transform: scale(0.9); -ms-transform: scale(0.9); transform: scale(0.9); } .hi-icon-effect-8 .hi-icon:hover { background: rgba(255,255,255,0.05); -webkit-transform: scale(0.93); -moz-transform: scale(0.93); -ms-transform: scale(0.93); transform: scale(0.93); color: #fff; } .hi-icon-effect-8 .hi-icon:hover:after { -webkit-animation: sonarEffect 1.3s ease-out 75ms; -moz-animation: sonarEffect 1.3s ease-out 75ms; animation: sonarEffect 1.3s ease-out 75ms; } @-webkit-keyframes sonarEffect { 0% { opacity: 0.3; } 40% { opacity: 0.5; box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 10px 10px #3851bc, 0 0 0 10px rgba(255,255,255,0.5); } 100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 10px 10px #3851bc, 0 0 0 10px rgba(255,255,255,0.5); -webkit-transform: scale(1.5); opacity: 0; } } @-moz-keyframes sonarEffect { 0% { opacity: 0.3; } 40% { opacity: 0.5; box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 10px 10px #3851bc, 0 0 0 10px rgba(255,255,255,0.5); } 100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 10px 10px #3851bc, 0 0 0 10px rgba(255,255,255,0.5); -moz-transform: scale(1.5); opacity: 0; } } @keyframes sonarEffect { 0% { opacity: 0.3; } 40% { opacity: 0.5; box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 10px 10px #3851bc, 0 0 0 10px rgba(255,255,255,0.5); } 100% { box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 0 10px 10px #3851bc, 0 0 0 10px rgba(255,255,255,0.5); transform: scale(1.5); opacity: 0; } } /* 特效6 */ .hi-icon-effect-9 .hi-icon { -webkit-transition: box-shadow 0.2s; -moz-transition: box-shadow 0.2s; transition: box-shadow 0.2s; } .hi-icon-effect-9 .hi-icon:after { top: 0; left: 0; padding: 0; box-shadow: 0 0 0 3px #fff; -webkit-transition: -webkit-transform 0.2s, opacity 0.2s; -moz-transition: -moz-transform 0.2s, opacity 0.2s; transition: transform 0.2s, opacity 0.2s; } /* 9a */ .hi-icon-effect-9a .hi-icon:hover:after { -webkit-transform: scale(0.85); -moz-transform: scale(0.85); -ms-transform: scale(0.85); transform: scale(0.85); opacity: 0.5; } .hi-icon-effect-9a .hi-icon:hover { box-shadow: 0 0 0 10px rgba(255,255,255,1); color: #fff; } /* 9b */ .hi-icon-effect-9b .hi-icon:hover:after { -webkit-transform: scale(0.85); -moz-transform: scale(0.85); -ms-transform: scale(0.85); transform: scale(0.85); } .hi-icon-effect-9b .hi-icon:hover { box-shadow: 0 0 0 10px rgba(255,255,255,0.4); color: #fff; }