Журнал Тильды
/
Библиотека промптов
/
Список команды со сменой фото при наведении
Команда
Список команды со сменой фото при наведении
Портрет сотрудника сменяется эффектом ламелей при наведении на строку с его именем. На телефоне фото переключается само при прокрутке списка.
Промпт
Вы можете скопировать промпт и вставить его в вайб блок в поле ввода. Подробнее в инструкции.
Команда: слева портрет-ламели, справа список из 5 сотрудников.

Контент в HTML: строки, img data-tilda-img="y", тексты data-tilda-edit="y". Без генерации контента через JS/массивы/innerHTML/canvas. Ламели заранее в HTML; JS анимирует и синхронизирует их с исходными img. В редакторе все фото/тексты доступны для правок, эффекты и перехват кликов отключены.

Фон #101215, белый текст, Arial/Helvetica. Секция grid: minmax(260px,440px) minmax(320px,720px), align-items:center, gap:clamp(36px,6vw,88px). Padding:92px по верху, 104px снизу, бока max(20px,(100% - 1160px)/2).
Слева портрет width:min(42vw,440px), 4:5, без скругления, overflow:hidden, фон #16191d. Cover, center top.

Над списком «OUR TEAM»: 11px regular, трекинг .18em, белый .5, margin-bottom:36px. Строки: grid 46px 1fr auto, gap:16px, padding:14px 0, разделители 1px белые .12. Слева фото 46×58px, radius:3px, cover top center; имя clamp(18px,1.9vw,26px), regular, line-height:1.2, трекинг -.015em; справа должность 12px/1.3, белая .5, max-width:210px. Неактивная строка opacity:.46, hover/активная 1 за 220ms. Под активной линия #e9704f растёт за 320ms cubic-bezier(.22,1,.36,1).

Имя | должность | фото:
Sara Marsh | Chief Executive Officer | https://static.tildacdn.com/tild6361-3366-4464-a538-303630393133/Team_17.jpg
Daniel Howe | Head of Product | https://static.tildacdn.com/tild3466-3461-4164-a333-323535383236/Team_18.jpg
Sasha Cole | Creative Director | https://static.tildacdn.com/tild3438-3731-4533-a333-356336343265/Team_19.jpg
Marcus Lee | Engineering Lead | https://static.tildacdn.com/tild3862-3131-4234-a335-313065396161/Team_20.jpg
Omar Vance | Strategy & Growth | https://static.tildacdn.com/tild3938-3436-4235-b363-363536626631/Team_21.jpg

Выбран первый. Hover строки меняет портрет, уход мыши сохраняет выбор. Без автопереключения. Горизонтальных полос: 8 при ширине кадра ≥400px, 7 при ≥280px, иначе 6. Переход сверху вниз, задержка полос i*62ms, 620ms каждая, easeInOutCubic. Старая полоса сжимается к центру по высоте, новая раскрывается: scaleY=abs(cos(π*easedProgress)), смена изображения в середине. Затемнение полосы .32*(1-scaleY), светлый шов .045. В покое цельный портрет без швов. Быстрый hover: заверши переход, затем выполни последний запрос.

768–1199px: колонки minmax(240px,340px) minmax(300px,1fr), gap:40px; портрет min(42vw,340px); миниатюры 42×54px, gap:13px, должности max-width:160px.
≤767px: одна колонка, padding:0 20px 76px. Портрет сверху sticky top:0, width:min(74vw,310px), 4:5; обёртка во всю ширину с padding:18px 20px 24px и тёмным фоном с прозрачным низом. Список ниже через 12px, метка с отступом 22px. Строки min-height:76px, padding:12px 0: фото 46×58px слева, имя 18px и должность 11px под ним справа, gap:13px. После списка padding-bottom:24vh.

На телефоне скролл выбирает строку с центром ближе к Y=min(.82*innerHeight,низ портрета+clamp(.14*innerHeight,72,120)); тот же переход. Изолируй CSS/JS; пересчёт при resize/правках. Reduced-motion: мгновенная смена.
Скопировать промпт
Код
Вы можете скопировать код и вставить его в вайб блок в раздел код. Подробнее в инструкции.
<section class="vbf-section" aria-labelledby="vbf-heading">

<!--
CONTENT

Header
Eyebrow

Team
Person
Photo
Name
Role
-->

<style>
.vbf-section,
.vbf-section * {
box-sizing: border-box;
}

.vbf-section {
--vbf-bg: #101215;
--vbf-panel: #16191d;
--vbf-text: #ffffff;
--vbf-muted: rgba(255,255,255,0.50);
--vbf-rule: rgba(255,255,255,0.12);
--vbf-accent: #e9704f;
--vbf-font: Arial, Helvetica, sans-serif;

--vbf-grid-width: 1200px;
--vbf-content-width: 1160px;
--vbf-gutter: 20px;

display: grid;
grid-template-columns: minmax(260px,440px) minmax(320px,720px);
align-items: center;
justify-content: center;
gap: clamp(36px,6vw,88px);

width: 100%;
margin: 0;

padding:
92px
max(
var(--vbf-gutter),
calc(
(
100% -
var(--vbf-content-width)
) /
2
)
)
104px;

overflow: clip;

background: var(--vbf-bg);
color: var(--vbf-text);

font-family: var(--vbf-font);
}

.vbf-board-wrap {
display: flex;
justify-content: flex-end;

min-width: 0;
}

.vbf-board {
position: relative;

width: min(42vw,440px);
max-width: 100%;
aspect-ratio: 4 / 5;

overflow: hidden;

background: var(--vbf-panel);
}

.vbf-canvas {
display: block;

width: 100%;
height: 100%;

pointer-events: none;
}

.vbf-side {
width: 100%;
min-width: 0;
}

.vbf-eyebrow {
margin: 0 0 36px;

font-size: 11px;
font-weight: 400;
line-height: 1.2;
letter-spacing: 0.18em;
text-transform: uppercase;

color: var(--vbf-muted);

cursor: text;
user-select: text;
-webkit-user-select: text;
pointer-events: auto;
}

.vbf-people {
display: flex;
flex-direction: column;

width: 100%;
margin: 0;
padding: 0;

list-style: none;
}

.vbf-person {
position: relative;

display: grid;
grid-template-columns: 46px minmax(0,1fr) auto;
align-items: center;
column-gap: 16px;

width: 100%;
min-width: 0;
padding: 14px 0;

border-top: 1px solid var(--vbf-rule);

opacity: 0.46;
cursor: default;

transition: opacity 220ms ease;
}

.vbf-person:last-child {
border-bottom: 1px solid var(--vbf-rule);
}

.vbf-person::after {
content: "";

position: absolute;
left: 0;
bottom: -1px;

width: 0;
height: 1px;

background: var(--vbf-accent);

transition:
width
320ms
cubic-bezier(0.22,1,0.36,1);
}

.vbf-person:hover,
.vbf-person.vbf-current {
opacity: 1;
}

.vbf-person.vbf-current::after {
width: 100%;
}

.vbf-person__photo {
display: block;

width: 46px;
height: 58px;

border-radius: 3px;

object-fit: cover;
object-position: center top;

pointer-events: auto;
}

.vbf-person__name {
min-width: 0;
margin: 0;

font-size: clamp(18px,1.9vw,26px);
font-weight: 400;
line-height: 1.2;
letter-spacing: -0.015em;

color: var(--vbf-text);

cursor: text;
user-select: text;
-webkit-user-select: text;
pointer-events: auto;
}

.vbf-person__role {
max-width: 210px;
margin: 0;

font-size: 12px;
font-weight: 400;
line-height: 1.3;
letter-spacing: 0.02em;
text-align: right;

color: var(--vbf-muted);

cursor: text;
user-select: text;
-webkit-user-select: text;
pointer-events: auto;
}

.vbf-section.vbf-empty .vbf-board-wrap {
display: none;
}

@media (min-width: 768px) and (max-width: 1199px) {
.vbf-section {
grid-template-columns: minmax(240px,340px) minmax(300px,1fr);
gap: 40px;
}

.vbf-board {
width: min(42vw,340px);
}

.vbf-person {
grid-template-columns: 42px minmax(0,1fr) auto;
column-gap: 13px;
}

.vbf-person__photo {
width: 42px;
height: 54px;
}

.vbf-person__role {
max-width: 160px;
}
}

@media (max-width: 767px) {
.vbf-section {
display: block;

padding:
0
var(--vbf-gutter)
76px;

overflow: visible;
}

.vbf-board-wrap {
position: sticky;
z-index: 4;
top: 0;

display: flex;
justify-content: center;

width:
calc(
100% +
var(--vbf-gutter) *
2
);

margin-left:
calc(
var(--vbf-gutter) *
-1
);

padding:
18px
var(--vbf-gutter)
24px;

background:
linear-gradient(
to bottom,
var(--vbf-bg) 0%,
var(--vbf-bg) 90%,
rgba(16,18,21,0) 100%
);
}

.vbf-board {
width: min(74vw,310px);
}

.vbf-side {
padding-top: 12px;
}

.vbf-eyebrow {
margin-bottom: 22px;
}

.vbf-person {
grid-template-columns: 46px minmax(0,1fr);
grid-template-rows: auto auto;
column-gap: 13px;
row-gap: 3px;

min-height: 76px;
padding: 12px 0;
}

.vbf-person__photo {
grid-column: 1;
grid-row: 1 / span 2;

width: 46px;
height: 58px;
}

.vbf-person__name {
grid-column: 2;
grid-row: 1;

font-size: 18px;
}

.vbf-person__role {
grid-column: 2;
grid-row: 2;

max-width: none;

font-size: 11px;
text-align: left;
}

.vbf-people {
padding-bottom: 24vh;
}
}

@media (prefers-reduced-motion: reduce) {
.vbf-person,
.vbf-person::after {
transition: none;
}
}
</style>

<div class="vbf-board-wrap" aria-hidden="true">
<div class="vbf-board">
<canvas class="vbf-canvas"></canvas>
</div>
</div>

<div class="vbf-side">

<p class="vbf-eyebrow" id="vbf-heading" data-tilda-edit="y">Our Team</p>

<ul class="vbf-people" role="list">

<li class="vbf-person vbf-current">
<img class="vbf-person__photo" data-tilda-img="y" src="https://static.tildacdn.com/tild6361-3366-4464-a538-303630393133/Team_17.jpg" alt="Elena Marsh" draggable="false">
<p class="vbf-person__name" data-tilda-edit="y">Sara Marsh</p>
<p class="vbf-person__role" data-tilda-edit="y">Chief Executive Officer</p>
</li>

<li class="vbf-person">
<img class="vbf-person__photo" data-tilda-img="y" src="https://static.tildacdn.com/tild3466-3461-4164-a333-323535383236/Team_18.jpg" alt="Daniel Howe" draggable="false">
<p class="vbf-person__name" data-tilda-edit="y">Daniel Howe</p>
<p class="vbf-person__role" data-tilda-edit="y">Head of Product</p>
</li>

<li class="vbf-person">
<img class="vbf-person__photo" data-tilda-img="y" src="https://static.tildacdn.com/tild3438-3731-4533-a333-356336343265/Team_19.jpg" alt="Sasha Cole" draggable="false">
<p class="vbf-person__name" data-tilda-edit="y">Sasha Cole</p>
<p class="vbf-person__role" data-tilda-edit="y">Creative Director</p>
</li>

<li class="vbf-person">
<img class="vbf-person__photo" data-tilda-img="y" src="https://static.tildacdn.com/tild3862-3131-4234-a335-313065396161/Team_20.jpg" alt="Marcus Lee" draggable="false">
<p class="vbf-person__name" data-tilda-edit="y">Marcus Lee</p>
<p class="vbf-person__role" data-tilda-edit="y">Engineering Lead</p>
</li>

<li class="vbf-person">
<img class="vbf-person__photo" data-tilda-img="y" src="https://static.tildacdn.com/tild3938-3436-4235-b363-363536626631/Team_21.jpg" alt="Omar Vance" draggable="false">
<p class="vbf-person__name" data-tilda-edit="y">Omar Vance</p>
<p class="vbf-person__role" data-tilda-edit="y">Strategy &amp; Growth</p>
</li>

</ul>

</div>

<script>
(function () {
'use strict';

var script = document.currentScript;

var section =
script &&
script.closest
? script.closest('.vbf-section')
: null;

if (
!section ||
section.classList.contains('vbf-ready')
) {
return;
}

var board =
section.querySelector('.vbf-board');

var canvas =
section.querySelector('.vbf-canvas');

var peopleList =
section.querySelector('.vbf-people');

if (
!board ||
!canvas ||
!peopleList
) {
return;
}

var context =
canvas.getContext('2d');

var mobile =
window.matchMedia('(max-width: 767px)');

var reducedMotion =
window.matchMedia('(prefers-reduced-motion: reduce)');

var people = [];
var currentIndex = 0;
var currentPerson = null;
var currentPhoto = null;
var nextPhoto = null;

var width = 1;
var height = 1;
var pixelRatio = 1;
var stripCount = 8;

var animationFrame = null;
var animationStart = 0;
var animationDuration = 620;
var stagger = 62;
var animating = false;
var queuedIndex = null;

var scrollFrame = null;
var mutationTimer = null;

var boundPeople =
new WeakSet();

function clamp(value,min,max) {
return Math.max(
min,
Math.min(max,value)
);
}

function easeInOut(value) {
return value < 0.5
? 4 * value * value * value
: 1 - Math.pow(-2 * value + 2,3) / 2;
}

function getPhoto(person) {
return person
? person.querySelector('.vbf-person__photo')
: null;
}

function setCurrent(index) {
people.forEach(
function (person,personIndex) {
person.classList.toggle(
'vbf-current',
personIndex === index
);
}
);
}

function bindPerson(person) {
if (
boundPeople.has(person)
) {
return;
}

boundPeople.add(person);

person.addEventListener(
'mouseenter',
function () {
if (mobile.matches) {
return;
}

var index =
people.indexOf(person);

if (
index >= 0
) {
selectPerson(index);
}
}
);
}

function refreshPeople() {
var retainedPerson = currentPerson;

people =
Array.prototype.slice.call(
peopleList.querySelectorAll('.vbf-person')
);

people.forEach(
bindPerson
);

section.classList.toggle(
'vbf-empty',
people.length === 0
);

if (
people.length === 0
) {
currentIndex = 0;
currentPerson = null;
currentPhoto = null;
nextPhoto = null;
animating = false;
queuedIndex = null;

context.clearRect(
0,
0,
width,
height
);

return;
}

var retainedIndex =
retainedPerson
? people.indexOf(retainedPerson)
: -1;

if (
retainedIndex >= 0
) {
currentIndex = retainedIndex;
}
else {
currentIndex =
clamp(
currentIndex,
0,
people.length - 1
);
}

currentPerson =
people[currentIndex];

currentPhoto =
getPhoto(currentPerson);

nextPhoto = null;
animating = false;
queuedIndex = null;

setCurrent(currentIndex);
renderStill();
requestMobileUpdate();
}

function getStripCount() {
if (width >= 400) return 8;
if (width >= 280) return 7;
return 6;
}

function resizeCanvas() {
var rect =
board.getBoundingClientRect();

width =
Math.max(
1,
Math.round(rect.width)
);

height =
Math.max(
1,
Math.round(rect.height)
);

pixelRatio =
Math.min(
2,
window.devicePixelRatio || 1
);

canvas.width =
Math.round(
width * pixelRatio
);

canvas.height =
Math.round(
height * pixelRatio
);

canvas.style.width =
width + 'px';

canvas.style.height =
height + 'px';

context.setTransform(
pixelRatio,
0,
0,
pixelRatio,
0,
0
);

stripCount =
getStripCount();

renderStill();
}

function getCoverSource(image) {
var naturalWidth =
image.naturalWidth || 1;

var naturalHeight =
image.naturalHeight || 1;

var imageRatio =
naturalWidth /
naturalHeight;

var frameRatio =
width /
height;

var sourceX = 0;
var sourceY = 0;
var sourceWidth = naturalWidth;
var sourceHeight = naturalHeight;

if (
imageRatio >
frameRatio
) {
sourceWidth =
naturalHeight *
frameRatio;

sourceX =
(
naturalWidth -
sourceWidth
) /
2;
}
else {
sourceHeight =
naturalWidth /
frameRatio;

sourceY = 0;
}

return {
x: sourceX,
y: sourceY,
width: sourceWidth,
height: sourceHeight
};
}

function drawFull(image) {
if (
!image ||
!image.complete ||
!image.naturalWidth
) {
return;
}

var source =
getCoverSource(image);

context.drawImage(
image,
source.x,
source.y,
source.width,
source.height,
0,
0,
width,
height
);
}

function drawSlice(
image,
stripIndex,
destinationCenterY,
visibleHeight
) {
if (
!image ||
!image.complete ||
!image.naturalWidth ||
visibleHeight <= 0
) {
return;
}

var source =
getCoverSource(image);

var stripHeight =
height /
stripCount;

var sourceStripY =
source.y +
source.height *
(
stripIndex /
stripCount
);

var sourceStripHeight =
source.height /
stripCount;

var top =
destinationCenterY -
visibleHeight /
2;

context.drawImage(
image,
source.x,
sourceStripY,
source.width,
sourceStripHeight,
0,
top,
width,
visibleHeight
);
}

function renderStill() {
context.clearRect(
0,
0,
width,
height
);

drawFull(currentPhoto);
}

function finishFlip(index) {
currentIndex = index;
currentPerson = people[index];
currentPhoto = nextPhoto;
nextPhoto = null;
animating = false;

renderStill();

if (
queuedIndex !== null
) {
var queued = queuedIndex;

queuedIndex = null;

selectPerson(queued);
}
}

function renderFlip(now) {
animationFrame = null;

if (
!animating ||
!currentPhoto ||
!nextPhoto
) {
return;
}

context.clearRect(
0,
0,
width,
height
);

var stripHeight =
height /
stripCount;

var finished = true;

for (
var index = 0;
index < stripCount;
index++
) {
var localTime =
now -
animationStart -
index * stagger;

var progress =
clamp(
localTime /
animationDuration,
0,
1
);

if (progress < 1) {
finished = false;
}

var eased =
easeInOut(progress);

var centerY =
index *
stripHeight +
stripHeight /
2;

var scale;

if (eased < 0.5) {
scale =
Math.cos(
eased *
Math.PI
);

drawSlice(
currentPhoto,
index,
centerY,
Math.max(
0.5,
stripHeight * scale
)
);
}
else {
scale =
-Math.cos(
eased *
Math.PI
);

drawSlice(
nextPhoto,
index,
centerY,
Math.max(
0.5,
stripHeight * scale
)
);
}

context.fillStyle =
'rgba(0,0,0,' +
(
0.32 *
(1 - scale)
).toFixed(3) +
')';

context.fillRect(
0,
centerY -
stripHeight *
scale /
2,
width,
stripHeight *
scale
);

context.fillStyle =
'rgba(255,255,255,0.045)';

context.fillRect(
0,
index * stripHeight,
width,
1
);
}

if (finished) {
finishFlip(currentIndex);

return;
}

animationFrame =
requestAnimationFrame(renderFlip);
}

function selectPerson(index) {
if (
index < 0 ||
index >= people.length
) {
return;
}

if (
index === currentIndex &&
!animating
) {
return;
}

if (animating) {
queuedIndex = index;

return;
}

var photo =
getPhoto(people[index]);

if (!photo) {
return;
}

setCurrent(index);

if (
reducedMotion.matches ||
!currentPhoto ||
!currentPhoto.complete ||
!photo.complete ||
!photo.naturalWidth
) {
currentIndex = index;
currentPerson = people[index];
currentPhoto = photo;
nextPhoto = null;

renderStill();

return;
}

currentIndex = index;
nextPhoto = photo;
animating = true;
animationStart =
performance.now();

animationFrame =
requestAnimationFrame(renderFlip);
}

function getPerson(target) {
var person =
target.closest
? target.closest('.vbf-person')
: null;

if (
!person ||
!peopleList.contains(person)
) {
return null;
}

return person;
}

function updateMobileCurrent() {
scrollFrame = null;

if (
!mobile.matches ||
people.length <= 1
) {
return;
}

var boardRect =
board.getBoundingClientRect();

var offset =
clamp(
window.innerHeight *
0.14,
72,
120
);

var targetY =
Math.min(
window.innerHeight *
0.82,
boardRect.bottom +
offset
);

var bestIndex = currentIndex;
var bestDistance = Infinity;

people.forEach(
function (person,index) {
var rect =
person.getBoundingClientRect();

var center =
rect.top +
rect.height /
2;

var distance =
Math.abs(
center -
targetY
);

if (
distance <
bestDistance
) {
bestDistance = distance;
bestIndex = index;
}
}
);

if (
bestIndex !== currentIndex
) {
selectPerson(bestIndex);
}
}

function requestMobileUpdate() {
if (
scrollFrame ||
!mobile.matches
) {
return;
}

scrollFrame =
requestAnimationFrame(
updateMobileCurrent
);
}

window.addEventListener(
'scroll',
requestMobileUpdate,
{ passive: true }
);

window.addEventListener(
'resize',
requestMobileUpdate,
{ passive: true }
);

section.addEventListener(
'load',
function (event) {
if (
event.target &&
event.target.classList &&
event.target.classList.contains(
'vbf-person__photo'
)
) {
if (
event.target === currentPhoto
) {
renderStill();
}
}
},
true
);

var resizeObserver =
new ResizeObserver(
resizeCanvas
);

resizeObserver.observe(board);

if (
'MutationObserver' in window
) {
var mutationObserver =
new MutationObserver(
function (records) {
var shouldRefresh =
records.some(
function (record) {
return (
record.type === 'childList' ||
(
record.type === 'attributes' &&
record.attributeName === 'src'
)
);
}
);

if (!shouldRefresh) {
return;
}

clearTimeout(mutationTimer);

mutationTimer =
setTimeout(
refreshPeople,
40
);
}
);

mutationObserver.observe(
peopleList,
{
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['src']
}
);
}

section.classList.add('vbf-ready');

refreshPeople();
resizeCanvas();
requestMobileUpdate();

})();
</script>

</section>
Скопировать код
Что выбрать, промпт или код?
Копируйте промпт, если хотите получить похожий результат, но ввести информацию о своём бизнесе и задать свои требования. Например, изменить кнопки, тексты, цвета, фотографии или другие элементы.
Копируйте код, если хотите получить точно такой же блок. Чтобы его изменить, придётся отредактировать html-код.
Начните создание сайта на Тильде с простой регистрации на платформе
Made on
Tilda