🌅 HérosGratuit · 0 NahnahPar NAHNAH AI
Héros vidéo de fond
Vidéo Shopify muette en boucle derrière le titre, image de repli, bouton pause accessible et lecture coupée si les animations sont réduites.
Aperçu en direct
Données de démonstration (produits, menus, textes d’exemple) : dans ta boutique, ce sont les tiennes.
Photos : Unsplash / Pexels (exemples de l’aperçu, jamais inclus dans le code).
Code à copier
Fichier complet sections/nahnah-hero-video.liquid (Liquid, CSS et JS inclus).
{%- comment -%} NAHNAH AI · Héros vidéo de fond (bibliothèque Sections & effets) {%- endcomment -%}
<nn-hero-video class="nn-hero-video" style="--nn-mh: {{ section.settings.marge_haut }}px; --nn-mb: {{ section.settings.marge_bas }}px; --nn-fond: {{ section.settings.couleur_fond }}; --nn-texte: {{ section.settings.couleur_texte }}; --nn-accent: {{ section.settings.couleur_accent }}; --nn-bouton: {{ section.settings.couleur_bouton }}; --nn-texte-bouton: {{ section.settings.couleur_texte_bouton }}; --nn-voile: {{ section.settings.voile | divided_by: 100.0 }};">
<div class="nn-hero-video__cadre nn-hero-video--h-{{ section.settings.hauteur }}">
<div class="nn-hero-video__media">
{%- if section.settings.video != blank -%}
{{ section.settings.video | video_tag: autoplay: true, muted: true, loop: true, playsinline: true, controls: false, preload: 'metadata', class: 'nn-hero-video__video', image_size: '1600x' }}
{%- else -%}
{%- if section.settings.image != blank -%}
{{ section.settings.image | image_url: width: 1600 | image_tag: class: 'nn-hero-video__img', sizes: '100vw', widths: '600, 900, 1200, 1600', loading: 'eager' }}
{%- else -%}
{{ 'hero-apparel-2' | placeholder_svg_tag: 'nn-hero-video__img nn-hero-video__img--vide' }}
{%- endif -%}
{%- endif -%}
</div>
<div class="nn-hero-video__voile" aria-hidden="true"></div>
<div class="nn-hero-video__contenu">
{%- if section.settings.surtitre != blank -%}
<p class="nn-hero-video__surtitre">{{ section.settings.surtitre | escape }}</p>
{%- endif -%}
{%- if section.settings.titre != blank -%}
<h2 class="nn-hero-video__titre">{{ section.settings.titre }}</h2>
{%- endif -%}
{%- if section.settings.texte != blank -%}
<div class="nn-hero-video__texte">{{ section.settings.texte }}</div>
{%- endif -%}
{%- if section.settings.bouton_texte != blank or section.settings.bouton2_texte != blank -%}
<div class="nn-hero-video__boutons">
{%- if section.settings.bouton_texte != blank -%}
<a class="nn-hero-video__bouton" href="{{ section.settings.bouton_lien | default: routes.all_products_collection_url }}">{{ section.settings.bouton_texte | escape }}</a>
{%- endif -%}
{%- if section.settings.bouton2_texte != blank -%}
<a class="nn-hero-video__bouton nn-hero-video__bouton--second" href="{{ section.settings.bouton2_lien | default: routes.collections_url }}">{{ section.settings.bouton2_texte | escape }}</a>
{%- endif -%}
</div>
{%- endif -%}
</div>
<button type="button" class="nn-hero-video__pause" data-nn-pause aria-label="Mettre la vidéo en pause" hidden><svg class="nn-hero-video__ico-pause" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="5" width="4" height="14" rx="1"/><rect x="14" y="5" width="4" height="14" rx="1"/></svg><svg class="nn-hero-video__ico-lecture" aria-hidden="true" focusable="false" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z"/></svg></button>
</div>
</nn-hero-video>
{% schema %}
{
"name": "Héros vidéo de fond",
"tag": "section",
"class": "nn-section-hero-video",
"settings": [
{
"type": "video",
"id": "video",
"label": "Vidéo (hébergée sur Shopify)"
},
{
"type": "image_picker",
"id": "image",
"label": "Image de repli (sans vidéo)"
},
{
"type": "range",
"id": "voile",
"label": "Opacité du voile",
"min": 0,
"max": 90,
"step": 5,
"default": 50,
"unit": "%"
},
{
"type": "select",
"id": "hauteur",
"label": "Hauteur",
"options": [
{
"value": "petite",
"label": "Petite"
},
{
"value": "moyenne",
"label": "Moyenne"
},
{
"value": "grande",
"label": "Grande"
},
{
"value": "ecran",
"label": "Plein écran"
}
],
"default": "grande"
},
{
"type": "text",
"id": "surtitre",
"label": "Sur-titre (vide : masqué)",
"default": "En mouvement"
},
{
"type": "inline_richtext",
"id": "titre",
"label": "Titre",
"default": "Vois-le en action"
},
{
"type": "richtext",
"id": "texte",
"label": "Texte",
"default": "<p>Une vidéo vaut mieux qu’un long discours : montre ton produit tel qu’il est, au quotidien.</p>"
},
{
"type": "header",
"content": "Boutons"
},
{
"type": "text",
"id": "bouton_texte",
"label": "Texte du bouton (vide : masqué)",
"default": "Découvrir"
},
{
"type": "url",
"id": "bouton_lien",
"label": "Lien du bouton (vide : tous les produits)"
},
{
"type": "text",
"id": "bouton2_texte",
"label": "Texte du bouton secondaire (vide : masqué)",
"default": "En savoir plus"
},
{
"type": "url",
"id": "bouton2_lien",
"label": "Lien du bouton secondaire (vide : collections)"
},
{
"type": "header",
"content": "Couleurs"
},
{
"type": "color",
"id": "couleur_fond",
"label": "Fond",
"default": "#05070D"
},
{
"type": "color",
"id": "couleur_texte",
"label": "Texte",
"default": "#FFFFFF"
},
{
"type": "color",
"id": "couleur_accent",
"label": "Accent",
"default": "#2EE6A8"
},
{
"type": "color",
"id": "couleur_bouton",
"label": "Bouton",
"default": "#2EE6A8"
},
{
"type": "color",
"id": "couleur_texte_bouton",
"label": "Texte du bouton",
"default": "#05070D"
},
{
"type": "header",
"content": "Espacement"
},
{
"type": "range",
"id": "marge_haut",
"label": "Marge haute",
"min": 0,
"max": 120,
"step": 4,
"unit": "px",
"default": 0
},
{
"type": "range",
"id": "marge_bas",
"label": "Marge basse",
"min": 0,
"max": 120,
"step": 4,
"unit": "px",
"default": 0
}
],
"presets": [
{
"name": "Héros vidéo de fond"
}
]
}
{% endschema %}
{% stylesheet %}
.nn-hero-video {
position: relative;
display: block;
padding: var(--nn-mh) 0 var(--nn-mb);
background: var(--nn-fond);
color: var(--nn-texte);
overflow-x: clip;
}
.nn-hero-video *, .nn-hero-video *::before, .nn-hero-video *::after { box-sizing: border-box; }
.nn-hero-video :where(a, button):focus-visible { outline: 3px solid var(--nn-accent); outline-offset: 3px; }
.nn-hero-video__surtitre { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--nn-accent); }
.nn-hero-video__titre { margin: 0 0 16px; font-size: clamp(32px, 6vw, 60px); line-height: 1.08; letter-spacing: -0.02em; overflow-wrap: anywhere; color: inherit; }
.nn-hero-video__texte { margin: 0 0 28px; font-size: clamp(16px, 1.6vw, 19px); line-height: 1.6; opacity: 0.88; max-width: 560px; }
.nn-hero-video__texte p { margin: 0 0 0.6em; }
.nn-hero-video__boutons { display: flex; flex-wrap: wrap; gap: 12px; }
.nn-hero-video__bouton {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 48px;
max-width: 100%;
padding: 14px 28px;
border-radius: var(--nn-arrondi-bouton, 8px);
background: var(--nn-bouton);
color: var(--nn-texte-bouton);
font-size: 16px;
font-weight: 700;
line-height: 1.2;
text-align: center;
text-decoration: none;
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nn-hero-video__bouton--second { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
@media (hover: hover) {
.nn-hero-video__bouton:hover { transform: translateY(-2px); box-shadow: 0 12px 26px color-mix(in srgb, var(--nn-bouton) 35%, transparent); }
.nn-hero-video__bouton--second:hover { box-shadow: inset 0 0 0 2px currentColor, 0 12px 26px rgba(0, 0, 0, 0.12); }
}
.nn-hero-video__vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nn-hero-video__cadre { position: relative; display: flex; align-items: center; isolation: isolate; overflow: hidden; }
.nn-hero-video--h-petite { min-height: 380px; }
.nn-hero-video--h-moyenne { min-height: clamp(440px, 62vh, 620px); }
.nn-hero-video--h-grande { min-height: clamp(520px, 80vh, 780px); }
.nn-hero-video--h-ecran { min-height: 100vh; min-height: 100svh; }
.nn-hero-video__media { position: absolute; inset: 0; z-index: -2; background: var(--nn-fond); }
.nn-hero-video__media > *, .nn-hero-video__video, .nn-hero-video__img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; border-radius: 0; }
.nn-hero-video__voile { position: absolute; inset: 0; z-index: -1; background: radial-gradient(120% 90% at 20% 50%, var(--nn-fond), transparent); opacity: var(--nn-voile); }
.nn-hero-video__voile::after { content: ""; position: absolute; inset: 0; background: var(--nn-fond); opacity: 0.5; }
.nn-hero-video__contenu { width: 100%; max-width: 1240px; margin: 0 auto; padding: clamp(40px, 8vw, 96px) 16px; }
.nn-hero-video__contenu > * { max-width: 640px; }
@media (min-width: 750px) { .nn-hero-video__contenu { padding-inline: 32px; } }
.nn-hero-video__titre { font-size: clamp(36px, 7vw, 80px); }
.nn-hero-video__titre::after { content: ""; display: block; width: 72px; height: 4px; margin-top: 18px; border-radius: 4px; background: var(--nn-accent); box-shadow: 0 0 18px var(--nn-accent); }
.nn-hero-video__pause {
position: absolute;
right: 16px;
bottom: 16px;
display: inline-grid;
place-items: center;
width: 48px;
height: 48px;
border: 1px solid color-mix(in srgb, var(--nn-texte) 40%, transparent);
border-radius: 50%;
background: color-mix(in srgb, var(--nn-fond) 55%, transparent);
color: var(--nn-texte);
cursor: pointer;
-webkit-backdrop-filter: blur(6px);
backdrop-filter: blur(6px);
}
.nn-hero-video__pause[hidden] { display: none; }
.nn-hero-video__pause svg { width: 20px; height: 20px; }
.nn-hero-video__ico-lecture { display: none; }
.nn-hero-video__pause--arret .nn-hero-video__ico-pause { display: none; }
.nn-hero-video__pause--arret .nn-hero-video__ico-lecture { display: block; }
@media (prefers-reduced-motion: reduce) {
.nn-hero-video, .nn-hero-video *, .nn-hero-video *::before, .nn-hero-video *::after {
animation: none !important;
transition: none !important;
}
}
{% endstylesheet %}
{% javascript %}
if (!customElements.get("nn-hero-video")) {
// Bouton lecture / pause de la vidéo de fond ; aucune lecture automatique si le visiteur réduit les animations
customElements.define("nn-hero-video", class extends HTMLElement {
connectedCallback() {
if (this.dataset.nnPret) return;
this.dataset.nnPret = "1";
var video = this.querySelector("video");
var bouton = this.querySelector("[data-nn-pause]");
if (!video || !bouton) return;
bouton.hidden = false;
var maj = function () {
var arret = video.paused;
bouton.classList.toggle("nn-hero-video__pause--arret", arret);
bouton.setAttribute("aria-label", arret ? "Lire la vidéo" : "Mettre la vidéo en pause");
};
if (window.matchMedia && window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
video.removeAttribute("autoplay");
video.pause();
}
video.addEventListener("play", maj);
video.addEventListener("pause", maj);
bouton.addEventListener("click", function () {
if (video.paused) {
var lecture = video.play();
if (lecture && lecture.catch) lecture.catch(function () {});
} else video.pause();
});
maj();
}
});
}
{% endjavascript %}
Licence NAHNAH AI : utilisation libre dans tes boutiques (y compris commerciales), modification permise, revente de l’élément seul interdite.
Prompt à copier
À coller dans Claude ou ChatGPT avec le fichier téléchargé (ou le code copié) : l’assistant t’aide à l’installer et à l’adapter à ta marque.
Tu es un expert des thèmes Shopify Online Store 2.0. Aide-moi à installer puis à adapter à ma marque cet élément gratuit de la bibliothèque NAHNAH AI.
Élément : « Héros vidéo de fond » (Héros)
Description : Vidéo Shopify muette en boucle derrière le titre, image de repli, bouton pause accessible et lecture coupée si les animations sont réduites.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/hero-video
Fichier : nahnah-hero-video.liquid (bouton « Télécharger » de la page) ou le code copié avec le bouton « Copier » : je te le joins ou je le colle après ce message.
Emplacement dans le thème : sections/nahnah-hero-video.liquid (Liquid, puis {% stylesheet %} et {% javascript %}, dans ce seul fichier).
Étapes d’installation :
1. Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
2. Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-hero-video ».
3. Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
4. Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.
Ce que j’attends de toi :
- Guide-moi pas à pas dans Shopify : Boutique en ligne → Thèmes → « … » → Modifier le code → dossier sections → Ajouter une section, puis Personnaliser → Ajouter une section.
- Propose-moi d’adapter les couleurs, les textes et les liens à ma marque : demande d’abord mes couleurs (codes hexadécimaux), mon ton et mes liens.
- Garde le bloc {% schema %} et tous ses réglages (identifiants, types, presets) : je dois pouvoir tout régler ensuite dans l’éditeur de thème.
- Rends-moi le fichier complet modifié, prêt à coller, sans faux avis, fausse urgence ni chiffre inventé.
Si tu as le connecteur NAHNAH AI (MCP), récupère directement le code exact avec l’outil obtenir_code_element (id : hero-video).Installer dans ma boutique
En un clic, la section est ajoutée à un thème de ta boutique Shopify connectée (un thème non publié par défaut).
Chargement de tes boutiques…
Installer dans Shopify
- Dans Shopify : Boutique en ligne → Thèmes → bouton « … » du thème → Modifier le code.
- Dossier « sections » → « Ajouter une section » (ou « Nouveau fichier ») → nomme-la « nahnah-hero-video ».
- Efface le contenu proposé, colle le code de l’onglet Liquid (fichier complet), puis Enregistrer.
- Ouvre Personnaliser → Ajouter une section → choisis-la, règle les textes et les couleurs, puis Enregistrer.
Installer via le MCP
Depuis Claude, Claude Code ou ChatGPT connecté à NAHNAH AI, demande : « Donne-moi le code de l’élément hero-video de la bibliothèque NAHNAH AI et les étapes pour l’installer ». L’assistant récupère le code et les étapes (outil obtenir_code_element), gratuitement.
Boutique connectée à NAHNAH AI : l’assistant peut aussi l’installer directement (outil installer_element).
Connecter le MCP