Posun stránky - scrollovací šipky

07.04.2017 Programování #html #css

Různé grafické styly scrollovacích šipek pomocí CSS.


Pro několik příkladů je společné nastavení HTML odkazu.

< a href="#" >< span >< / span >Scroll< / a> 
a {
	position: absolute;
	bottom: 20px;
	left: 50%;
	z-index: 2;
	display: inline-block;
	-webkit-transform: translate(0, -50%);
	transform: translate(0, -50%);
	text-decoration: none;
}

Šipka

css-scroll-down-button_01

a {
	padding-top: 60px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 24px;
	height: 24px;
	margin-left: -12px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	box-sizing: border-box;
}

Šipka v kruhu

css-scroll-down-button_02

    a {
	padding-top: 60px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 46px;
	height: 46px;
	margin-left: -23px;
	border: 1px solid #fff;
	border-radius: 100%;
	box-sizing: border-box;
}
a span::after {
	position: absolute;
	top: 50%;
	left: 50%;
	content: '';
	width: 16px;
	height: 16px;
	margin: -12px 0 0 -8px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	box-sizing: border-box;
}

Šipka v kruhu s rozptylem

css-scroll-down-button_03

a {
	padding-top: 60px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 46px;
	height: 46px;
	margin-left: -23px;
	border: 1px solid #fff;
	border-radius: 100%;
	box-sizing: border-box;
}
a span::after {
	position: absolute;
	top: 50%;
	left: 50%;
	content: '';
	width: 16px;
	height: 16px;
	margin: -12px 0 0 -8px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	box-sizing: border-box;
}
a span::before {
	position: absolute;
	top: 0;
	left: 0;
	z-index: -1;
	content: '';
	width: 44px;
	height: 44px;
	box-shadow: 0 0 0 0 rgba(255,255,255,.1);
	border-radius: 100%;
	opacity: 0;
	-webkit-animation: sdb 3s infinite;
	animation: sdb 3s infinite;
	box-sizing: border-box;
}
@-webkit-keyframes sdb {
	0% {
		opacity: 0;
	}
	30% {
		opacity: 1;
	}
	60% {
		box-shadow: 0 0 0 60px rgba(255,255,255,.1);
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes sdb {
	0% {
		opacity: 0;
	}
	30% {
		opacity: 1;
	}
	60% {
		box-shadow: 0 0 0 60px rgba(255,255,255,.1);
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}

Animace šipky

css-scroll-down-button_04

a {
	padding-top: 60px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 24px;
	height: 24px;
	margin-left: -12px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	-webkit-animation: sdb 2s infinite;
	animation: sdb 2s infinite;
	box-sizing: border-box;
}
@-webkit-keyframes sdb {
	0% {
		-webkit-transform: rotate(-45deg) translate(0, 0);
	}
	20% {
		-webkit-transform: rotate(-45deg) translate(-10px, 10px);
	}
	40% {
		-webkit-transform: rotate(-45deg) translate(0, 0);
	}
}
@keyframes sdb {
	0% {
		transform: rotate(-45deg) translate(0, 0);
	}
	20% {
		transform: rotate(-45deg) translate(-10px, 10px);
	}
	40% {
		transform: rotate(-45deg) translate(0, 0);
	}
}

Animace šipky II

css-scroll-down-button_05

a {
	padding-top: 70px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 24px;
	height: 24px;
	margin-left: -12px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	-webkit-animation: sdb 1.5s infinite;
	animation: sdb 1.5s infinite;
	box-sizing: border-box;
}
@-webkit-keyframes sdb {
	0% {
		-webkit-transform: rotate(-45deg) translate(0, 0);
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
	100% {
		-webkit-transform: rotate(-45deg) translate(-20px, 20px);
		opacity: 0;
	}
}
@keyframes sdb {
	0% {
		transform: rotate(-45deg) translate(0, 0);
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
	100% {
		transform: rotate(-45deg) translate(-20px, 20px);
		opacity: 0;
	}
}

Animace šipky III

css-scroll-down-button_06

a {
	padding-top: 70px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 24px;
	height: 24px;
	margin-left: -12px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotateZ(-45deg);
	transform: rotateZ(-45deg);
	-webkit-animation: sdb 1.5s infinite;
	animation: sdb 1.5s infinite;
	box-sizing: border-box;
}
@-webkit-keyframes sdb {
	0% {
		-webkit-transform: rotateY(0) rotateZ(-45deg) translate(0, 0);
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
	100% {
		-webkit-transform: rotateY(720deg) rotateZ(-45deg) translate(-20px, 20px);
		opacity: 0;
	}
}
@keyframes sdb {
	0% {
		transform: rotateY(0) rotateZ(-45deg) translate(0, 0);
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
	100% {
		transform: rotateY(720deg) rotateZ(-45deg) translate(-20px, 20px);
		opacity: 0;
	}
}

Animace šipky IV

css-scroll-down-button_07

< a href="#" >< span >< / span >< span >< / span >< span >< / span >Scroll< / a >
a {
	padding-top: 80px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 24px;
	height: 24px;
	margin-left: -12px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	-webkit-animation: sdb 2s infinite;
	animation: sdb 2s infinite;
	opacity: 0;
	box-sizing: border-box;
}
a span:nth-of-type(1) {
	-webkit-animation-delay: 0s;
	animation-delay: 0s;
}
a span:nth-of-type(2) {
	top: 16px;
	-webkit-animation-delay: .15s;
	animation-delay: .15s;
}
a span:nth-of-type(3) {
	top: 32px;
	-webkit-animation-delay: .3s;
	animation-delay: .3s;
}
@-webkit-keyframes sdb {
	0% {
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}
@keyframes sdb {
	0% {
		opacity: 0;
	}
	50% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}

Myš

css-scroll-down-button_08

a {
	padding-top: 60px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 30px;
	height: 50px;
	margin-left: -15px;
	border: 2px solid #fff;
	border-radius: 50px;
	box-sizing: border-box;
}
a span::before {
	position: absolute;
	top: 10px;
	left: 50%;
	content: '';
	width: 6px;
	height: 6px;
	margin-left: -3px;
	background-color: #fff;
	border-radius: 100%;
	box-sizing: border-box;
}
    

Myš a šipka

css-scroll-down-button_09

a {
	padding-top: 80px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 30px;
	height: 50px;
	margin-left: -15px;
	border: 2px solid #fff;
	border-radius: 50px;
	box-sizing: border-box;
}
a span::before {
	position: absolute;
	top: 10px;
	left: 50%;
	content: '';
	width: 6px;
	height: 6px;
	margin-left: -3px;
	background-color: #fff;
	border-radius: 100%;
	box-sizing: border-box;
}
a span::after {
	position: absolute;
	bottom: -18px;
	left: 50%;
	width: 18px;
	height: 18px;
	content: '';
	margin-left: -9px;
	border-left: 1px solid #fff;
	border-bottom: 1px solid #fff;
	-webkit-transform: rotate(-45deg);
	transform: rotate(-45deg);
	box-sizing: border-box;
}

Animace myši

css-scroll-down-button_10

a {
	padding-top: 60px;
}
a span {
	position: absolute;
	top: 0;
	left: 50%;
	width: 30px;
	height: 50px;
	margin-left: -15px;
	border: 2px solid #fff;
	border-radius: 50px;
	box-sizing: border-box;
}
a span::before {
	position: absolute;
	top: 10px;
	left: 50%;
	content: '';
	width: 6px;
	height: 6px;
	margin-left: -3px;
	background-color: #fff;
	border-radius: 100%;
	-webkit-animation: sdb 2s infinite;
	animation: sdb 2s infinite;
	box-sizing: border-box;
}
@-webkit-keyframes sdb {
	0% {
		-webkit-transform: translate(0, 0);
		opacity: 0;
	}
	40% {
		opacity: 1;
	}
	80% {
		-webkit-transform: translate(0, 20px);
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}
@keyframes sdb {
	0% {
		transform: translate(0, 0);
		opacity: 0;
	}
	40% {
		opacity: 1;
	}
	80% {
		transform: translate(0, 20px);
		opacity: 0;
	}
	100% {
		opacity: 0;
	}
}