mirror of
https://git.rdcenter.ru/RDCenter/skb-kit.git
synced 2026-12-05 05:09:46 +00:00
логика для замены картинки на гиф при наведении
This commit is contained in:
1 parent
0569b78d94
commit
1622a1bc50
3 files changed
+42
-4
No files matched your search
@@ -1 +1,2 @@
|
|||||||
export { default as Illustration } from './Illustration.svg';
|
export { default as Illustration } from './Illustration.svg';
|
||||||
|
export { default as Illustration2 } from './Illustration2.gif';
|
||||||
@@ -2,7 +2,27 @@
|
|||||||
margin-bottom: 60px;
|
margin-bottom: 60px;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
pointer-events: none;
|
//pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-wrapper {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
// Все остальные стили из предыдущего примера
|
||||||
|
}
|
||||||
|
|
||||||
|
// Дополнительная защита для Firefox
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
@@ -50,9 +70,11 @@
|
|||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
|
|
||||||
.block-content {
|
.block-content {
|
||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.numbers-grid {
|
.numbers-grid {
|
||||||
grid-template-columns: repeat(2, 1fr); // 2 колонки на мобильных (2x3)
|
grid-template-columns: repeat(2, 1fr); // 2 колонки на мобильных (2x3)
|
||||||
}
|
}
|
||||||
@@ -60,9 +82,11 @@
|
|||||||
|
|
||||||
@media (max-width: 500px) {
|
@media (max-width: 500px) {
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
|
|
||||||
.block-content {
|
.block-content {
|
||||||
margin-top: 24px;
|
margin-top: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import "./Numbers.styles.scss";
|
import "./Numbers.styles.scss";
|
||||||
import { Illustration } from '@/shared/assets/images/numbers';
|
import { Illustration, Illustration2 } from '@/shared/assets/images/numbers';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
const Numbers = () => {
|
const Numbers = () => {
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
const yearsSince2015 = currentYear - 2015;
|
const yearsSince2015 = currentYear - 2015;
|
||||||
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="block" id="numbers">
|
<div className="block" id="numbers">
|
||||||
@@ -35,7 +37,18 @@ const Numbers = () => {
|
|||||||
<label>обученных студентов</label>
|
<label>обученных студентов</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<img className="visible" src={Illustration} alt="Illustration" />
|
<div
|
||||||
|
className="image-wrapper"
|
||||||
|
onMouseEnter={() => setIsHovered(true)}
|
||||||
|
onMouseLeave={() => setIsHovered(false)}
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
className="visible"
|
||||||
|
src={isHovered ? Illustration : Illustration}
|
||||||
|
alt="СКБ КИТ"
|
||||||
|
draggable="false"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user