以下是 js 14种圆点导航动画样式特效代码 的示例演示效果:
部分效果截图1:
部分效果截图2:
HTML代码(index.html):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="JS代码,菜单导航,JS广告代码,JS特效代码" />
<meta name="description" content="此代码内容为14种圆点导航动画样式,属于站长常用代码" />
<title>14种圆点导航动画样式</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css" />
<link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<script src="js/modernizr.min.js"></script>
</head>
<body>
<!-- 代码 开始 -->
<div class="container">
<header class="codrops-header">
<h1>14种圆点导航动画样式<span>Subtle effects for simple dot navigation</span></h1>
</header>
<div class="wrap clearfix">
<div class="dotstyle dotstyle-fillup">
<h2>Fill up</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-scaleup">
<h2>Scale up</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-stroke">
<h2>Stroke</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-fillin">
<h2>Fill in</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-circlegrow">
<h2>Circle grow</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-dotstroke">
<h2>Dot stroke</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-drawcircle">
<h2>Draw circle</h2>
<ul>
<li class="current"><a href="#">Home</a><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16"preserveAspectRatio="none"><circle cx="8" cy="8" r="6.215"/></svg></li>
<li><a href="#">About</a><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16"preserveAspectRatio="none"><circle cx="8" cy="8" r="6.215"/></svg></li>
<li><a href="#">Products</a><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16"preserveAspectRatio="none"><circle cx="8" cy="8" r="6.215"/></svg></li>
<li><a href="#">Portfolio</a><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16"preserveAspectRatio="none"><circle cx="8" cy="8" r="6.215"/></svg></li>
<li><a href="#">Blog</a><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16"preserveAspectRatio="none"><circle cx="8" cy="8" r="6.215"/></svg></li>
<li><a href="#">Contact</a><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 16 16"preserveAspectRatio="none"><circle cx="8" cy="8" r="6.215"/></svg></li>
</ul>
</div>
<div class="dotstyle dotstyle-smalldotstroke">
<h2>Small dot stroke</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-puff">
<h2>Puff</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-flip">
<h2>Flip</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-tooltip">
<h2>Tooltip</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-dotmove">
<h2>Dot move</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
<li><!-- dummy dot --></li>
</ul>
</div>
<div class="dotstyle dotstyle-hop">
<h2>Hop</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
<div class="dotstyle dotstyle-fall">
<h2>Fall</h2>
<ul>
<li class="current"><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</div><!-- /container -->
<script src="js/dots.js"></script>
<script>
[].slice.call( document.querySelectorAll( '.dotstyle > ul' ) ).forEach( function( nav ) {
new DotNav( nav, {
callback : function( idx ) {
//console.log( idx )
}
} );
} );
</script>
</body>
<!-- 代码 结束 -->
</body>
</html>
JS代码(dots.js):
/** * menu.js v1.0.0 * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2014,Codrops * http://www.codrops.com */
;
( function( window ){
'use strict';
function extend( a,b ){
for( var key in b ){
if( b.hasOwnProperty( key ) ){
a[key] = b[key];
}
}
return a;
}
function DotNav( el,options ){
this.nav = el;
this.options = extend({
}
,this.options );
extend( this.options,options );
this._init();
}
DotNav.prototype.options ={
}
;
DotNav.prototype._init = function(){
// special case "dotstyle-hop"var hop = this.nav.parentNode.className.indexOf( 'dotstyle-hop' ) !== -1;
var dots = [].slice.call( this.nav.querySelectorAll( 'li' ) ),current = 0,self = this;
dots.forEach( function( dot,idx ){
dot.addEventListener( 'click',function( ev ){
ev.preventDefault();
if( idx !== current ){
dots[ current ].className = '';
// special caseif( hop && idx < current ){
dot.className += ' current-from-right';
}
setTimeout( function(){
dot.className += ' current';
current = idx;
if( typeof self.options.callback === 'function' ){
self.options.callback( current );
}
}
,25 );
}
}
);
}
);
}
// add to global namespacewindow.DotNav = DotNav;
}
)( window );
JS代码(modernizr.min.js):
/* Modernizr 2.7.1 (Custom Build) | MIT & BSD * Build:http://modernizr.com/download/#-touch-shiv-cssclasses-teststyles-prefixes-load */
;
window.Modernizr=function(a,b,c){
function w(a){
j.cssText=a}
function x(a,b){
return w(m.join(a+";
")+(b||""))}
function y(a,b){
return typeof a===b}
function z(a,b){
return!!~(""+a).indexOf(b)}
function A(a,b,d){
for(var e in a){
var f=b[a[e]];
if(f!==c)return d===!1?a[e]:y(f,"function")?f.bind(d||b):f}
return!1}
var d="2.7.1",e={
}
,f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={
}
.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n={
}
,o={
}
,p={
}
,q=[],r=q.slice,s,t=function(a,c,d,e){
var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");
if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);
return f=["­
",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i}
,u={
}
.hasOwnProperty,v;
!y(u,"undefined")&&!y(u.call,"undefined")?v=function(a,b){
return u.call(a,b)}
:v=function(a,b){
return b in a&&y(a.constructor.prototype[b],"undefined")}
,Function.prototype.bind||(Function.prototype.bind=function(b){
var c=this;
if(typeof c!="function")throw new TypeError;
var d=r.call(arguments,1),e=function(){
if(this instanceof e){
var a=function(){
}
;
a.prototype=c.prototype;
var f=new a,g=c.apply(f,d.concat(r.call(arguments)));
return Object(g)===g?g:f}
return c.apply(b,d.concat(r.call(arguments)))}
;
return e}
),n.touch=function(){
var c;
return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:t(["@media (",m.join("touch-enabled),("),h,")","{
#modernizr{
top:9px;
position:absolute}
}
"].join(""),function(a){
c=a.offsetTop===9}
),c}
;
for(var B in n)v(n,B)&&(s=B.toLowerCase(),e[s]=n[B](),q.push((e[s]?"":"no-")+s));
return e.addTest=function(a,b){
if(typeof a=="object")for(var d in a)v(a,d)&&e.addTest(d,a[d]);
else{
a=a.toLowerCase();
if(e[a]!==c)return e;
b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}
return e}
,w(""),i=k=null,function(a,b){
function l(a,b){
var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;
return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}
function m(){
var a=s.elements;
return typeof a=="string"?a.split(" "):a}
function n(a){
var b=j[a[h]];
return b||(b={
}
,i++,a[h]=i,j[i]=b),b}
function o(a,c,d){
c||(c=b);
if(k)return c.createElement(a);
d||(d=n(c));
var g;
return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}
function p(a,c){
a||(a=b);
if(k)return a.createDocumentFragment();
c=c||n(a);
var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;
for(;
e<g;
e++)d.createElement(f[e]);
return d}
function q(a,b){
b.cache||(b.cache={
}
,b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){
return s.shivMethods?o(c,a,b):b.createElem(c)}
,a.createDocumentFragment=Function("h,f","return function(){
var n=f.cloneNode(),c=n.createElement;
h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){
return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'}
)+");
return n}
")(s,b.frag)}
function r(a){
a||(a=b);
var c=n(a);
return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{
display:block}
mark{
background:#FF0;
color:#000}
template{
display:none}
")),k||q(a,c),a}
var c="3.7.0",d=a.html5||{
}
,e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={
}
,k;
(function(){
try{
var a=b.createElement("a");
a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){
b.createElement("a");
var a=b.createDocumentFragment();
return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}
()}
catch(c){
g=!0,k=!0}
}
)();
var s={
elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p}
;
a.html5=s,r(b)}
(this,b),e._version=d,e._prefixes=m,e.testStyles=t,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+q.join(" "):""),e}
(this,this.document),function(a,b,c){
function d(a){
return"[object Function]"==o.call(a)}
function e(a){
return"string"==typeof a}
function f(){
}
function g(a){
return!a||"loaded"==a||"complete"==a||"uninitialized"==a}
function h(){
var a=p.shift();
q=1,a?a.t?m(function(){
("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)}
,0):(a(),h()):q=0}
function i(a,c,d,e,f,i,j){
function k(b){
if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){
"img"!=a&&m(function(){
t.removeChild(l)}
,50);
for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}
}
var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={
t:d,s:c,e:f,a:i,x:j}
;
1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){
k.call(this,r)}
,p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}
function j(a,b,c,d,f){
return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}
function k(){
var a=B;
return a.loader={
load:j,i:0}
,a}
var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={
}
.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){
return"[object Array]"==o.call(a)}
,x=[],y={
}
,z={
timeout:function(a,b){
return b.length&&(a.timeout=b[0]),a}
}
,A,B;
B=function(a){
function b(a){
var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={
url:c,origUrl:c,prefixes:a}
,e,f,g;
for(f=0;
f<d;
f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));
for(f=0;
f<b;
f++)c=x[f](c);
return c}
function g(a,e,f,g,h){
var i=b(a),j=i.autoCallback;
i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){
k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2}
)))}
function h(a,b){
function c(a,c){
if(a){
if(e(a))c||(j=function(){
var a=[].slice.call(arguments);
k.apply(this,a),l()}
),g(a,j,b,0,h);
else if(Object(a)===a)for(n in m=function(){
var b=0,c;
for(c in a)a.hasOwnProperty(c)&&b++;
return b}
(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){
var a=[].slice.call(arguments);
k.apply(this,a),l()}
:j[n]=function(a){
return function(){
var b=[].slice.call(arguments);
a&&a.apply(this,b),l()}
}
(k[n])),g(a[n],j,b,n,h))}
else!c&&l()}
var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;
c(h?a.yep:a.nope,!!i),i&&c(i)}
var i,j,l=this.yepnope.loader;
if(e(a))g(a,0,l,0);
else if(w(a))for(i=0;
i<a.length;
i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);
else Object(a)===a&&h(a,l)}
,B.addPrefix=function(a,b){
z[a]=b}
,B.addFilter=function(a){
x.push(a)}
,B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){
b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"}
,0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){
var k=b.createElement("script"),l,o,e=e||B.errorTimeout;
k.src=a;
for(o in d)k.setAttribute(o,d[o]);
c=j?h:c||f,k.onreadystatechange=k.onload=function(){
!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)}
,m(function(){
l||(l=1,c(1))}
,e),i?k.onload():n.parentNode.insertBefore(k,n)}
,a.yepnope.injectCss=function(a,c,d,e,g,i){
var e=b.createElement("link"),j,c=i?h:c||f;
e.href=a,e.rel="stylesheet",e.type="text/css";
for(j in d)e.setAttribute(j,d[j]);
g||(n.parentNode.insertBefore(e,n),m(c,0))}
}
(this,document),Modernizr.load=function(){
yepnope.apply(window,[].slice.call(arguments,0))}
;
CSS代码(component.css):
/* Common styles and resets */
.dotstyle ul{position:relative;display:inline-block;margin:0;padding:0;list-style:none;cursor:default;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}
.dotstyle li{position:relative;display:block;float:left;margin:0 16px;width:16px;height:16px;cursor:pointer;}
.dotstyle li a{top:0;left:0;width:100%;height:100%;outline:none;border-radius:50%;background-color:#fff;background-color:rgba(255,255,255,0.3);text-indent:-999em;/* make the text accessible to screen readers */
cursor:pointer;position:absolute;}
.dotstyle li a:focus{outline:none;}
/* Individual styles and effects */
/* Fill up */
.dotstyle-fillup li a{overflow:hidden;background-color:transparent;box-shadow:inset 0 0 0 2px white;-webkit-transition:background 0.3s ease;transition:background 0.3s ease;}
.dotstyle-fillup li a::after{content:'';position:absolute;bottom:0;height:0;left:0;width:100%;background-color:#fff;box-shadow:0 0 1px #fff;-webkit-transition:height 0.3s ease;transition:height 0.3s ease;}
.dotstyle-fillup li a:hover,.dotstyle-fillup li a:focus{background-color:rgba(0,0,0,0.2);}
.dotstyle-fillup li.current a::after{height:100%;}
/* Scale up */
.dotstyle-scaleup li a{-webkit-transition:-webkit-transform 0.3s ease,background-color 0.3s ease;transition:transform 0.3s ease,background-color 0.3s ease;}
.dotstyle-scaleup li a:hover,.dotstyle-scaleup li a:focus{background-color:white;}
.dotstyle-scaleup li.current a{background-color:white;-webkit-transform:scale(1.5);transform:scale(1.5);}
/* Stroke */
.dotstyle-stroke li a{box-shadow:0 0 0 2px rgba(255,255,255,0);-webkit-transition:box-shadow 0.3s ease,background-color 0.3s ease;transition:box-shadow 0.3s ease,background-color 0.3s ease;}
.dotstyle-stroke li a:hover,.dotstyle-stroke li a:focus{background-color:white;}
.dotstyle-stroke li.current a{background-color:transparent;box-shadow:0 0 0 2px white;}
/* Fill in */
.dotstyle-fillin li a{background-color:transparent;box-shadow:inset 0 0 0 2px white;-webkit-transition:box-shadow 0.3s ease;transition:box-shadow 0.3s ease;}
.dotstyle-fillin li a:hover,.dotstyle-fillin li a:focus{box-shadow:inset 0 0 0 2px rgba(255,255,255,0.6)}
.dotstyle-fillin li.current a{box-shadow:inset 0 0 0 8px white;}
/* Circle grow */
.dotstyle-circlegrow li a{overflow:hidden;background-color:transparent;box-shadow:inset 0 0 0 2px white;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease;}
.dotstyle-circlegrow li a::after{content:'';position:absolute;width:100%;height:100%;left:0;border-radius:50%;background-color:#fff;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:50% 50%;transform-origin:50% 50%;-webkit-transition:-webkit-transform 0.3s ease;transition:transform 0.3s ease;}
.dotstyle-circlegrow li a:hover,.dotstyle-circlegrow li a:focus{opacity:0.7;}
.dotstyle-circlegrow li.current a::after{-webkit-transform:scale(1);transform:scale(1);}
/* Dot to stroke */
.dotstyle-dotstroke li a{box-shadow:inset 0 0 0 8px rgba(255,255,255,0.5);-webkit-transition:box-shadow 0.3s ease;transition:box-shadow 0.3s ease;}
.dotstyle-dotstroke li a:hover,.dotstyle-dotstroke li a:focus{box-shadow:inset 0 0 0 8px white;}
.dotstyle-dotstroke li.current a{box-shadow:inset 0 0 0 2px white;}
/* SVG draw circle stroke */
.dotstyle-drawcircle li{width:18px;height:18px;}
.dotstyle-drawcircle li a{top:3px;left:3px;width:12px;height:12px;background-color:#c44d48;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease;}
.dotstyle-drawcircle li svg{z-index:10;}
.dotstyle-drawcircle li svg circle{opacity:0;fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:39 39;stroke-dashoffset:39;/* length of circle path (pi*2r) */
-webkit-transition:stroke-dashoffset 0.3s,opacity 0.3s;transition:stroke-dashoffset 0.3s,opacity 0.3s;}
.dotstyle-drawcircle li.current a,.dotstyle-drawcircle li a:hover,.dotstyle-drawcircle li a:focus{opacity:0.5;}
.dotstyle-drawcircle li.current svg circle{opacity:1;stroke-dashoffset:0;-webkit-transition:stroke-dashoffset 0.3s,opacity 0.15s;transition:stroke-dashoffset 0.3s,opacity 0.15s;}
/* Small dot with stroke */
.dotstyle-smalldotstroke li{border-radius:50%;box-shadow:0 0 0 2px rgba(255,255,255,0);-webkit-transition:box-shadow 0.3s ease;transition:box-shadow 0.3s ease;}
.dotstyle-smalldotstroke li a{background-color:rgba(255,255,255,0.7);-webkit-transition:background-color 0.3s ease,-webkit-transform 0.3s ease;transition:background-color 0.3s ease,transform 0.3s ease;}
.dotstyle-smalldotstroke li a:hover,.dotstyle-smalldotstroke li a:focus,.dotstyle-smalldotstroke li.current a{background-color:white}
.dotstyle-smalldotstroke li.current a{-webkit-transform:scale(0.4);transform:scale(0.4);}
.dotstyle-smalldotstroke li.current{box-shadow:0 0 0 2px white;}
/* Puff */
.dotstyle-puff li a{border:2px solid #fff;-webkit-transition:border-color 0.3s ease;transition:border-color 0.3s ease;}
.dotstyle-puff li a::after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;visibility:hidden;background:#c44d48;border-radius:50%;box-shadow:0 0 1px #c44d48;opacity:0;-webkit-transform:scale(3);transform:scale(3);-webkit-transition:opacity 0.3s ease,-webkit-transform 0.3s ease,visibility 0s 0.3s;transition:opacity 0.3s ease,transform 0.3s ease,visibility 0s 0.3s;}
.dotstyle-puff li a:hover,.dotstyle-puff li a:focus,.dotstyle-puff li.current a{border-color:#c44d48;}
.dotstyle-puff li.current a::after{visibility:visible;opacity:1;-webkit-transform:scale(1);transform:scale(1);-webkit-transition:opacity 0.3s ease,-webkit-transform 0.3s ease;transition:opacity 0.3s ease,transform 0.3s ease;}
/* 3D Flip */
.dotstyle-flip li{-webkit-perspective:1000px;perspective:1000px;}
.dotstyle-flip li a{background-color:transparent;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease;transition:transform 0.3s ease,opacity 0.3s ease;}
.dotstyle-flip li a::before,.dotstyle-flip li a::after{position:absolute;top:0;left:0;width:100%;height:100%;border-radius:50%;background-color:white;content:'';text-indent:0;-webkit-backface-visibility:hidden;backface-visibility:hidden;}
.dotstyle-flip li a::after{background-color:#c44d48;-webkit-transform:rotateY(180deg);transform:rotateY(180deg);}
.dotstyle-flip li a:hover,.dotstyle-flip li a:focus{opacity:0.8;}
.dotstyle-flip li.current a{-webkit-transform:rotateY(180deg);transform:rotateY(180deg);}
/* Tooltip */
.dotstyle-tooltip li{border:2px solid #fff;border-radius:50%;z-index:1;-webkit-transition:border-color 0.3s ease;transition:border-color 0.3s ease;}
.dotstyle-tooltip li a{top:auto;bottom:250%;left:50%;visibility:hidden;padding:0 10px;width:auto;height:auto;border-radius:0;background-color:#c44d48;color:#fff;text-indent:0;line-height:2;opacity:0;-webkit-transform:translateX(-50%) translateY(-50%);transform:translateX(-50%) translateY(-50%);-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease,visibility 0s 0.3s ease;transition:transform 0.3s ease,opacity 0.3s ease,visibility 0s 0.3s ease;}
.dotstyle-tooltip li a::after{/* http://cssarrowplease.com/ */
position:absolute;left:50%;margin-left:-10px;width:0;height:0;border:solid transparent;border-width:10px;border-color:transparent;border-top-color:#c44d48;content:'';pointer-events:none;top:99%;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:opacity 0.3s ease;transition:opacity 0.3s ease;}
.no-touch .dotstyle-tooltip li:hover a,.dotstyle-tooltip li.current a{z-index:100;visibility:visible;opacity:1;-webkit-transform:translateX(-50%) translateY(0%);transform:translateX(-50%) translateY(0%);-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease;transition:transform 0.3s ease,opacity 0.3s ease;}
.dotstyle-tooltip li.current{border-color:#c44d48;}
.dotstyle-tooltip li:hover{z-index:100;}
.no-touch .dotstyle-tooltip ul:hover li.current a{opacity:0.2;}
.dotstyle-tooltip ul li.current:hover a{opacity:1;}
/* Dot move */
.dotstyle-dotmove li:last-child{position:absolute;left:0;margin:0;width:48px;-webkit-transition:-webkit-transform 0.3s ease;transition:transform 0.3s ease;}
.dotstyle-dotmove li:last-child::after{content:'';position:absolute;left:50%;top:-1px;width:18px;height:18px;border-radius:50%;background:#c44d48;-webkit-transform:translateX(-50%);transform:translateX(-50%);}
.dotstyle-dotmove li.current:first-child ~ li:last-child{-webkit-transform:translateX(0%);transform:translateX(0%);}
.dotstyle-dotmove li.current:nth-child(2) ~ li:last-child{-webkit-transform:translateX(100%);transform:translateX(100%);}
.dotstyle-dotmove li.current:nth-child(3) ~ li:last-child{-webkit-transform:translateX(200%);transform:translateX(200%);}
.dotstyle-dotmove li.current:nth-child(4) ~ li:last-child{-webkit-transform:translateX(300%);transform:translateX(300%);}
.dotstyle-dotmove li.current:nth-child(5) ~ li:last-child{-webkit-transform:translateX(400%);transform:translateX(400%);}
.dotstyle-dotmove li.current:nth-child(6) ~ li:last-child{-webkit-transform:translateX(500%);transform:translateX(500%);}
.dotstyle-dotmove li a{-webkit-transition:background-color 0.3s ease;transition:background-color 0.3s ease;}
.dotstyle-dotmove li a:hover,.dotstyle-dotmove li a:focus{background-color:#fff;}
/* Fly in */
.dotstyle-hop li a{border:2px solid #c44d48;background:transparent;}
.dotstyle-hop li a::after{content:'';width:100%;height:100%;position:absolute;left:0;border-radius:50%;visibility:hidden;background:#fff;opacity:0;-webkit-transform:rotate(-100deg);transform:rotate(-100deg);-webkit-transform-origin:-200% 50%;transform-origin:-200% 50%;-webkit-transition:-webkit-transform 0.3s ease 0.3s,opacity 0.3s ease,visibility 0s 0.3s ease;transition:transform 0.3s ease 0.3s,opacity 0.3s ease,visibility 0s 0.3s ease;}
.dotstyle-hop li a:focus{background:rgba(255,255,255,0.2);}
.dotstyle-hop li.current-from-right a::after{-webkit-transition:none;transition:none;-webkit-transform:rotate(100deg);transform:rotate(100deg);-webkit-transform-origin:300% 50%;transform-origin:300% 50%;}
.dotstyle-hop li.current a::after{visibility:visible;opacity:1;-webkit-transform:rotate(0deg);transform:rotate(0deg);-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease;transition:transform 0.3s ease,opacity 0.3s ease;}
/* Fall */
.dotstyle-fall li::after{content:'';position:absolute;width:100%;height:100%;visibility:hidden;opacity:0;left:0;background-color:#c44d48;border-radius:50%;-webkit-transform:translateY(-200%);transform:translateY(-200%);-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease,visibility 0s 0.3s;transition:transform 0.3s ease,opacity 0.3s ease,visibility 0s 0.3s;}
.dotstyle-fall li a{-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease,background-color 0.3s ease;transition:transform 0.3s ease,opacity 0.3s ease,background-color 0.3s ease;}
.dotstyle-fall li:hover a,.dotstyle-fall li a:focus,.dotstyle-fall li.current a{background-color:#fff;}
.dotstyle-fall li.current::after{opacity:1;visibility:visible;-webkit-transition:-webkit-transform 0.3s ease,opacity 0.3s ease;transition:transform 0.3s ease,opacity 0.3s ease;-webkit-transform:translateY(0%);transform:translateY(0%);}
.dotstyle-fall li.current a{opacity:0;-webkit-transform:translateY(200%);transform:translateY(200%);}
CSS代码(demo.css):
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,700);@font-face{font-weight:normal;font-style:normal;font-family:'codropsicons';src:url('../fonts/codropsicons/codropsicons.eot');src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'),url('../fonts/codropsicons/codropsicons.woff') format('woff'),url('../fonts/codropsicons/codropsicons.ttf') format('truetype'),url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');}
*,*:after,*:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
body{background:#fff;color:#777;font-weight:400;font-size:1em;font-family:'Lato',Arial,sans-serif;}
.clearfix:before,.clearfix:after{content:'';display:table;}
.clearfix:after{clear:both;}
a{color:#f4726d;text-decoration:none;outline:none;}
a:hover,a:focus{color:#c44d48;}
.codrops-header{margin:0 auto;padding:4.5em 2em;text-align:center;}
.codrops-header h1{margin:0;font-weight:300;font-size:2.5em;line-height:1.3;}
.codrops-header h1 span{display:block;padding:0 0 0.6em 0.1em;font-size:60%;opacity:0.7;}
/* To Navigation Style */
.codrops-top{width:100%;text-transform:uppercase;font-weight:700;font-size:0.69em;line-height:2.2;background:#fff;}
.codrops-top a{display:inline-block;padding:0 1em;text-decoration:none;letter-spacing:1px;}
.codrops-top span.right{float:right;}
.codrops-top span.right a{display:block;float:left;}
.codrops-icon:before{margin:0 4px;text-transform:none;font-weight:normal;font-style:normal;font-variant:normal;font-family:'codropsicons';line-height:1;speak:none;-webkit-font-smoothing:antialiased;}
.codrops-icon-drop:before{content:"\e001";}
.codrops-icon-prev:before{content:"\e004";}
.related{text-align:center;font-size:1.25em;padding:3em 0;overflow:hidden;}
.related a{display:inline-block;text-align:left;margin:20px auto;padding:10px 20px;opacity:0.8;color:#777;-webkit-transition:opacity 0.3s;transition:opacity 0.3s;-webkit-backface-visibility:hidden;}
.related a:hover,.related a:active{opacity:1;}
.related a img{max-width:100%;}
.related a h3{font-weight:300;margin:0;padding:0.3em 0;}
.wrap{background-color:#f4726d}
.wrap > div{float:left;overflow:hidden;padding:0 0 8em;height:275px;width:50%;text-align:center;}
.wrap > div h2{text-transform:uppercase;letter-spacing:1px;margin:0;padding:4em 0 5em;font-size:0.85em;color:#c44d48;}
.dotstyle:nth-child(4n),.dotstyle:nth-child(4n-3){background-color:rgba(0,0,0,0.05);}
@media screen and (max-width:42em){.wrap > div{float:none;width:100%;}
.dotstyle:nth-child(4n),.dotstyle:nth-child(4n-3){background-color:rgba(0,0,0,0);}
.dotstyle:nth-child(odd){background-color:rgba(0,0,0,0.05);}
}
@media screen and (max-width:25em){.codrops-icon span{display:none;}
.codrops-icon:before{font-size:160%;line-height:2;}
}
CSS代码(normalize.css):
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}
audio,canvas,video{display:inline-block;}
audio:not([controls]){display:none;height:0;}
[hidden]{display:none;}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}
body{margin:0;}
a:focus{outline:thin dotted;}
a:active,a:hover{outline:0;}
h1{font-size:2em;margin:0.67em 0;}
abbr[title]{border-bottom:1px dotted;}
b,strong{font-weight:bold;}
dfn{font-style:italic;}
hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}
mark{background:#ff0;color:#000;}
code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}
pre{white-space:pre-wrap;}
q{quotes:"\201C" "\201D" "\2018" "\2019";}
small{font-size:80%;}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}
sup{top:-0.5em;}
sub{bottom:-0.25em;}
img{border:0;}
svg:not(:root){overflow:hidden;}
figure{margin:0;}
fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}
legend{border:0;padding:0;}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}
button,input{line-height:normal;}
button,select{text-transform:none;}
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}
button[disabled],html input[disabled]{cursor:default;}
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}
input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}
textarea{overflow:auto;vertical-align:top;}
table{border-collapse:collapse;border-spacing:0;}