У меня дорогой переход CSS на моем веб-сайте (я создал облако, которое становится более прозрачным, если вы прокручиваете сверху вниз). На старых компьютерах вся моя страница начинает отставать (прокрутка также запаздывает), так есть ли какое-нибудь решение для них? - Сделайте переход менее плавным, но оставьте ЦП для прокрутки и т. Д. - или определите старые / более медленные компьютеры и отключите весь переход.
До: После: Время перехода: 10 сек c.
Github
$(window).scroll(function() {
if ($(window).scrollTop() < 100) {
$("#cloud-back").css('box-shadow', '100vw 110vh 30px 0px #fff')
} else {
$("#cloud-back").css('box-shadow', '100vw 110vh 200px -100px #fff')
}
});
:root {
--action: rgb(40, 51, 99);
--gradient: linear-gradient(145deg, rgb(40, 51, 99), #13cadd);
--shadow: 0 0 3rem 0 rgba(0, 0, 0, .4);
--background: #FFF;
--grayWhite: #f5f5f5;
--block-text: #FFF;
--gradientLight: #13cadd;
--gradientDark: rgb(40, 51, 99);
--lightBlue: #8cc9e6;
--sky: rgb(9, 33, 70);
--blue: #007bff;
--indigo: #6610f2;
--purple: #6f42c1;
--pink: #e83e8c;
--red: #dc3545;
--orange: #f4623a;
--yellow: #ffc107;
--green: #28a745;
--teal: #20c997;
--cyan: #17a2b8;
--white: #fff;
--gray: #6c757d;
--gray-dark: #343a40;
--primary: #f4623a;
--secondary: #6c757d;
--success: #28a745;
--info: #17a2b8;
--warning: #ffc107;
--danger: #dc3545;
--light: #f8f9fa;
--dark: #343a40;
--breakpoint-xs: 0;
--breakpoint-sm: 576px;
--breakpoint-md: 768px;
--breakpoint-lg: 992px;
--breakpoint-xl: 1200px;
}
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family: 'Roboto';
line-height: 1.15;
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
background-color: var(--sky);
}
header,
section {
display: block;
}
body {
margin: 0;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #212529;
text-align: left;
background-color: var(--background);
overflow-x: hidden;
}
h2,
h4 {
margin-top: 0;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
svg {
overflow: hidden;
vertical-align: middle;
}
button:not(:disabled),
[type="button"]:not(:disabled),
[type="reset"]:not(:disabled),
[type="submit"]:not(:disabled) {
cursor: pointer;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
h2,
h4 {
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h2 {
font-size: 2rem;
}
h4 {
font-size: 1.5rem;
}
.container {
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 576px) {
.container {
max-width: 540px;
}
}
@media (min-width: 768px) {
.container {
max-width: 720px;
}
}
@media (min-width: 992px) {
.container {
max-width: 960px;
}
}
@media (min-width: 1200px) {
.container {
max-width: 1140px;
}
}
.row {
display: flex;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.col,
.col-lg-3,
.col-lg-8 {
position: relative;
width: 100%;
padding-right: 15px;
padding-left: 15px;
}
.col {
flex-basis: 0;
flex-grow: 1;
max-width: 100%;
}
@media (min-width: 992px) {
.col-lg-3 {
flex: 0 0 25%;
max-width: 25%;
}
.col-lg-8 {
flex: 0 0 66.66667%;
max-width: 66.66667%;
}
}
.was-validated .custom-control-input:valid:focus:not(:checked)~.custom-control-label::before,
.custom-control-input.is-valid:focus:not(:checked)~.custom-control-label::before {
border-color: #28a745;
}
.was-validated .custom-control-input:invalid:focus:not(:checked)~.custom-control-label::before,
.custom-control-input.is-invalid:focus:not(:checked)~.custom-control-label::before {
border-color: #dc3545;
}
.btn-primary:not(:disabled):not(.disabled):active,
.btn-primary:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #ee3e0d;
border-color: #e23a0d;
}
.btn-primary:not(:disabled):not(.disabled):active:focus,
.btn-primary:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(246, 122, 88, 0.5);
}
.btn-secondary:not(:disabled):not(.disabled):active,
.btn-secondary:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #545b62;
border-color: #4e555b;
}
.btn-secondary:not(:disabled):not(.disabled):active:focus,
.btn-secondary:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(130, 138, 145, 0.5);
}
.btn-success:not(:disabled):not(.disabled):active,
.btn-success:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #1e7e34;
border-color: #1c7430;
}
.btn-success:not(:disabled):not(.disabled):active:focus,
.btn-success:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(72, 180, 97, 0.5);
}
.btn-info:not(:disabled):not(.disabled):active,
.btn-info:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #117a8b;
border-color: #10707f;
}
.btn-info:not(:disabled):not(.disabled):active:focus,
.btn-info:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(58, 176, 195, 0.5);
}
.btn-warning:not(:disabled):not(.disabled):active,
.btn-warning:not(:disabled):not(.disabled).active {
color: #212529;
background-color: #d39e00;
border-color: #c69500;
}
.btn-warning:not(:disabled):not(.disabled):active:focus,
.btn-warning:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(222, 170, 12, 0.5);
}
.btn-danger:not(:disabled):not(.disabled):active,
.btn-danger:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #bd2130;
border-color: #b21f2d;
}
.btn-danger:not(:disabled):not(.disabled):active:focus,
.btn-danger:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(225, 83, 97, 0.5);
}
.btn-light:not(:disabled):not(.disabled):active,
.btn-light:not(:disabled):not(.disabled).active {
color: #212529;
background-color: #dae0e5;
border-color: #d3d9df;
}
.btn-light:not(:disabled):not(.disabled):active:focus,
.btn-light:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(216, 217, 219, 0.5);
}
.btn-dark:not(:disabled):not(.disabled):active,
.btn-dark:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #1d2124;
border-color: #171a1d;
}
.btn-dark:not(:disabled):not(.disabled):active:focus,
.btn-dark:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(82, 88, 93, 0.5);
}
.btn-outline-primary:not(:disabled):not(.disabled):active,
.btn-outline-primary:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #f4623a;
border-color: #f4623a;
}
.btn-outline-primary:not(:disabled):not(.disabled):active:focus,
.btn-outline-primary:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(244, 98, 58, 0.5);
}
.btn-outline-secondary:not(:disabled):not(.disabled):active,
.btn-outline-secondary:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #6c757d;
border-color: #6c757d;
}
.btn-outline-secondary:not(:disabled):not(.disabled):active:focus,
.btn-outline-secondary:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
}
.btn-outline-success:not(:disabled):not(.disabled):active,
.btn-outline-success:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #28a745;
border-color: #28a745;
}
.btn-outline-success:not(:disabled):not(.disabled):active:focus,
.btn-outline-success:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.5);
}
.btn-outline-info:not(:disabled):not(.disabled):active,
.btn-outline-info:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #17a2b8;
border-color: #17a2b8;
}
.btn-outline-info:not(:disabled):not(.disabled):active:focus,
.btn-outline-info:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.5);
}
.btn-outline-warning:not(:disabled):not(.disabled):active,
.btn-outline-warning:not(:disabled):not(.disabled).active {
color: #212529;
background-color: #ffc107;
border-color: #ffc107;
}
.btn-outline-warning:not(:disabled):not(.disabled):active:focus,
.btn-outline-warning:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.5);
}
.btn-outline-danger:not(:disabled):not(.disabled):active,
.btn-outline-danger:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #dc3545;
border-color: #dc3545;
}
.btn-outline-danger:not(:disabled):not(.disabled):active:focus,
.btn-outline-danger:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.5);
}
.btn-outline-light:not(:disabled):not(.disabled):active,
.btn-outline-light:not(:disabled):not(.disabled).active {
color: #212529;
background-color: #f8f9fa;
border-color: #f8f9fa;
}
.btn-outline-light:not(:disabled):not(.disabled):active:focus,
.btn-outline-light:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(248, 249, 250, 0.5);
}
.btn-outline-dark:not(:disabled):not(.disabled):active,
.btn-outline-dark:not(:disabled):not(.disabled).active {
color: #fff;
background-color: #343a40;
border-color: #343a40;
}
.btn-outline-dark:not(:disabled):not(.disabled):active:focus,
.btn-outline-dark:not(:disabled):not(.disabled).active:focus {
box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5);
}
.custom-control-input:focus:not(:checked)~.custom-control-label::before {
border-color: #fbc2b3;
}
.custom-control-input:not(:disabled):active~.custom-control-label::before {
color: #fff;
background-color: #fde9e3;
border-color: #fde9e3;
}
.close:not(:disabled):not(.disabled):hover,
.close:not(:disabled):not(.disabled):focus {
opacity: .75;
}
.justify-content-center {
justify-content: center !important;
}
.align-items-center {
align-items: center !important;
}
@supports ((position: -webkit-sticky) or (position: sticky)) {}
.m-5 {
margin: 3rem !important;
}
.p-5 {
padding: 3rem !important;
}
.text-center {
text-align: center !important;
}
.text-white {
color: #fff !important;
}
.text-muted {
color: #6c757d !important;
}
@media print {
*,
*::before,
*::after {
text-shadow: none !important;
box-shadow: none !important;
}
p,
h2 {
orphans: 3;
widows: 3;
}
h2 {
page-break-after: avoid;
}
@page {
size: a3;
}
body {
min-width: 992px !important;
}
.container {
min-width: 992px !important;
}
}
body,
html {
width: 100%;
height: 100%;
}
.page-section {
padding: 8rem 0;
}
.two-blocks {
padding-top: 80px;
padding-bottom: 80px;
box-shadow: var(--shadow);
border-radius: 5px;
overflow: hidden;
color: var(--block-text);
background-color: #0039e4;
background: var(--gradient);
transition: box-shadow .3s linear, filter .6s linear;
}
.two-blocks:hover {
filter: brightness(1.1);
box-shadow: 0 0 3rem 0 rgba(0, 0, 0, .5);
}
.bg-img {
position: absolute;
width: 100vw;
height: 140vh;
background: var(--sky);
overflow: hidden;
}
.cloud {
width: 110vw;
height: 130vh;
border-radius: 20%;
position: absolute;
top: -130vh;
left: -105vw;
}
#cloud-back {
filter: url(#filter-back);
transition: box-shadow 10s;
}
.minh-100 {
min-height: 100vh;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="DaWe">
<title>CSS clouds</title>
<link href="https://fonts.googleapis.com/css?family=Roboto:100i,300,400,500,700" rel="stylesheet">
</head>
<body id="page-top">
<header class="minh-100" id="main">
<!-- Cloud div -->
<div class="bg-img">
<div class="cloud" id="cloud-back" style="box-shadow: 100vw 110vh 30px 0px #fff"></div>
<svg width="0" height="0">
<filter id="filter-back">
<feTurbulence type="fractalNoise" baseFrequency="0.012" numOctaves="4" seed="0" />
<feDisplacementMap in="SourceGraphic" scale="170" />
</filter>
</svg>
</div>
<div class="row align-items-center justify-content-center text-center minh-100">
<div class="col"></div>
<div class="col-lg-3 two-blocks">
<h2>Scroll down</h2>
<h4>100px</h4>
</div>
<div class="col"></div>
<div class="col-lg-3 two-blocks">
<h2>Scroll down</h2>
<h4>100px</h4>
</div>
<div class="col"></div>
</div>
</header>
<!-- Contact Section -->
<section class="page-section" id="contact">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8 text-center">
<h2 class="m-5 p-5 text-white">Hmmm</h2>
<p class="text-muted m-5 p-5">When you scroll up, foggy cloud comes back ;)</p>
</div>
</div>
</div>
</section>
<script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
</body>
</html>