@thesirvlad

Как сделать что бы при нажатие стрелочки вверх появлялся блок?

Я имею такой код.
<div class="map">
    <div class="airplane"></div>
    <div class="point point_1"></div>
    <div class="point point_2"></div>
    <div class="point point_3"></div>
    <div class="point point_4"></div>
    <div class="point point_5"></div>
    <div class="point point_6"></div>
</div>

@-webkit-keyframes pulsing {
  0% {
    -webkit-transform: scale(0.5, 0.5);
    transform: scale(0.5, 0.5)
  }
  50% {
    -webkit-transform: scale(1.0, 1.0);
    transform: scale(1.0, 1.0);
  }
  100% {
    -webkit-transform: scale(0.5, 0.5);
    transform: scale(0.5, 0.5);
  }
}

@keyframes pulsing {
  0% {
    -webkit-transform: scale(0.5, 0.5);
    transform: scale(0.5, 0.5)
  }
  50% {
    -webkit-transform: scale(1.0, 1.0);
    transform: scale(1.0, 1.0);
  }
  100% {
    -webkit-transform: scale(0.5, 0.5);
    transform: scale(0.5, 0.5);
  }
}
.map {
            position: relative;
            overflow: hidden;
            max-width: 1200px;
            height: 675px;
            margin: 20px auto;
            background-size: cover;
            border: 1px solid #ccc;
        }

.airplane {
            position: absolute;
            width: 50px;
            height: 50px;
            background: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjAuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCINCgkgdmlld0JveD0iMCAwIDUxMS45OTIgNTExLjk5MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEx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lzMzEuOTk5LDM1LjMxMiwzMS45OTksNTMuMzI3YzAsMTguODc1LTguNTc3LDMwNC4zMTUtMTAuMzU4LDM2Mi42NTdMMjY2LjE3NSw0NTguNjUyTDI2Ni4xNzUsNDU4LjY1MnogTTQ5MC42NDYsMzE3LjU2DQoJCWwtMTg2Ljc3Ny0zOC44NDJjMC43ODEtMjYuNzU4LDEuNTYyLTUzLjQxNCwyLjI1LTc3Ljc4OGwxODQuNTI3LDkzLjYzMlYzMTcuNTZ6Ii8+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8L3N2Zz4NCg==") no-repeat;
            transform: rotate(90deg);
            offset-path: path('M 235,323 Q 412,440 365,615 Q 400,300 670,240 L 870,340 L 975,535 Q 730,600 630,535 z');
            animation: airplane-fly 13s infinite linear;
          z-index: 2;
        }

        .point {
            position: absolute;
            width: 15px;
            height: 15px;
            background-color: #ffffff;
            border: 1px solid #ccc;
            border-radius: 50%;
            box-shadow: 0 2px 3px 0 rgba(0, 0, 0, .05);
        }

        .point_1 {
            top: 323px;
            left: 235px;
        }

        .point_2 {
            top: 615px;
            left: 365px;
        }

        .point_3 {
            top: 240px;
            left: 670px;
        }

        .point_4 {
            top: 340px;
            left: 870px;
        }

        .point_5 {
            top: 535px;
            left: 975px;
        }

        .point_6 {
            top: 535px;
            left: 630px;
        }

        @keyframes airplane-fly {
            0% {
                offset-distance: 0;
            }
            100% {
                offset-distance: 100%;
            }
        }


Это аэроплан, мне нужно что бы он появлялся только при нажатии стрелочки вверх на клавиатуре. (Типо пасхалки) Но так как я новичок я не знаю как это сделать. Заранее спасибо
  • Вопрос задан
  • 81 просмотр
Пригласить эксперта
Ответы на вопрос 1
@Aricus
Через javascript это нужно делать. Добавьте к аэроплану CSS-класс с display:none, а в javascript при событии onkeypress и условии e.key == 'ArrowUp' удалите этот класс.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы
28 нояб. 2024, в 05:21
2000 руб./за проект
28 нояб. 2024, в 05:18
500 руб./за проект
28 нояб. 2024, в 03:51
3500 руб./за проект