Aller au contenu

🎠 CarrouselsGratuit · 0 NahnahPar NAHNAH

Carrousel de looks à acheter

Diapositives de photos d’ambiance avec des points cliquables posés sur les produits : chaque point ouvre une mini-fiche (image, prix, lien) ; flèches, glisser et clavier.

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-carrousels-looks-shoppables.liquid (Liquid, CSS et JS inclus).

{%- comment -%} NAHNAH AI · Carrousel de looks à acheter {%- endcomment -%}
<div class="nn-carrousels-looks-shoppables" 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 }};">
  <div class="nn-carrousels-looks-shoppables__entete">
    {%- if section.settings.titre != blank -%}<h2 class="nn-carrousels-looks-shoppables__titre">{{ section.settings.titre | escape }}</h2>{%- endif -%}
    <div class="nn-carrousels-looks-shoppables__fleches">
      <button type="button" class="nn-carrousels-looks-shoppables__btn" data-nn-prec aria-label="Look précédent">←</button>
      <button type="button" class="nn-carrousels-looks-shoppables__btn" data-nn-suiv aria-label="Look suivant">→</button>
    </div>
  </div>
  <ul class="nn-carrousels-looks-shoppables__piste" role="list" data-nn-piste>
    {%- for block in section.blocks -%}
      <li class="nn-carrousels-looks-shoppables__look" {{ block.shopify_attributes }}>
        <div class="nn-carrousels-looks-shoppables__photo">
          {%- if block.settings.image != blank -%}{{ block.settings.image | image_url: width: 1200 | image_tag: loading: 'lazy', alt: block.settings.legende }}{%- endif -%}
          {%- for n in (1..2) -%}
            {%- if n == 1 -%}{%- assign p = block.settings.produit_1 -%}{%- assign px = block.settings.x_1 -%}{%- assign py = block.settings.y_1 -%}{%- else -%}{%- assign p = block.settings.produit_2 -%}{%- assign px = block.settings.x_2 -%}{%- assign py = block.settings.y_2 -%}{%- endif -%}
            {%- if p != blank -%}
              <div class="nn-carrousels-looks-shoppables__point" style="left: {{ px }}%; top: {{ py }}%;{% if px > 55 %} --nn-cote: -100%;{% endif %}">
                <button type="button" aria-expanded="false" aria-label="Voir {{ p.title | escape }}"><span>+</span></button>
                <a class="nn-carrousels-looks-shoppables__fiche" href="{{ p.url }}" hidden>
                  {%- if p.featured_image -%}{{ p.featured_image | image_url: width: 160 | image_tag: loading: 'lazy', alt: '' }}{%- endif -%}
                  <span><strong>{{ p.title | escape }}</strong><em>{{ p.price | money }}</em></span>
                </a>
              </div>
            {%- endif -%}
          {%- endfor -%}
        </div>
        {%- if block.settings.legende != blank -%}<p class="nn-carrousels-looks-shoppables__legende">{{ block.settings.legende | escape }}</p>{%- endif -%}
      </li>
    {%- endfor -%}
  </ul>
</div>

{% schema %}
{
  "name": "Looks à acheter",
  "tag": "section",
  "class": "nn-section-carrousels-looks-shoppables",
  "max_blocks": 8,
  "settings": [
    { "type": "text", "id": "titre", "label": "Titre", "default": "Achetez le look" },
    { "type": "header", "content": "Couleurs" },
    { "type": "color", "id": "couleur_fond", "label": "Fond", "default": "#FAFAF7" },
    { "type": "color", "id": "couleur_texte", "label": "Texte", "default": "#151515" },
    { "type": "color", "id": "couleur_accent", "label": "Points", "default": "#FFFFFF" },
    { "type": "header", "content": "Espacement" },
    { "type": "range", "id": "marge_haut", "label": "Marge haute", "min": 0, "max": 120, "step": 4, "unit": "px", "default": 40 },
    { "type": "range", "id": "marge_bas", "label": "Marge basse", "min": 0, "max": 120, "step": 4, "unit": "px", "default": 40 }
  ],
  "blocks": [
    {
      "type": "look",
      "name": "Look",
      "settings": [
        { "type": "image_picker", "id": "image", "label": "Photo d’ambiance" },
        { "type": "text", "id": "legende", "label": "Légende", "default": "Le look du week-end" },
        { "type": "header", "content": "Point 1" },
        { "type": "product", "id": "produit_1", "label": "Produit" },
        { "type": "range", "id": "x_1", "label": "Position horizontale", "min": 0, "max": 100, "step": 1, "unit": "%", "default": 35 },
        { "type": "range", "id": "y_1", "label": "Position verticale", "min": 0, "max": 100, "step": 1, "unit": "%", "default": 40 },
        { "type": "header", "content": "Point 2" },
        { "type": "product", "id": "produit_2", "label": "Produit" },
        { "type": "range", "id": "x_2", "label": "Position horizontale", "min": 0, "max": 100, "step": 1, "unit": "%", "default": 65 },
        { "type": "range", "id": "y_2", "label": "Position verticale", "min": 0, "max": 100, "step": 1, "unit": "%", "default": 70 }
      ]
    }
  ],
  "presets": [
    {
      "name": "Looks à acheter",
      "blocks": [
        { "type": "look" },
        { "type": "look", "settings": { "legende": "L’essentiel du quotidien" } },
        { "type": "look", "settings": { "legende": "Idée cadeau" } }
      ]
    }
  ]
}
{% endschema %}

{% stylesheet %}
.nn-carrousels-looks-shoppables { padding: var(--nn-mh) 16px var(--nn-mb); background: var(--nn-fond); color: var(--nn-texte); }
.nn-carrousels-looks-shoppables__entete { display: flex; justify-content: space-between; align-items: end; gap: 16px; max-width: 1200px; margin: 0 auto 20px; }
.nn-carrousels-looks-shoppables__titre { margin: 0; font-size: clamp(24px, 3.4vw, 38px); }
.nn-carrousels-looks-shoppables__fleches { display: flex; gap: 10px; }
.nn-carrousels-looks-shoppables__btn { width: 46px; height: 46px; border: 2px solid currentColor; border-radius: 50%; background: none; color: inherit; font-size: 18px; cursor: pointer; }
.nn-carrousels-looks-shoppables__btn:focus-visible { outline: 2px solid var(--nn-texte); outline-offset: 3px; }
.nn-carrousels-looks-shoppables__piste { display: flex; gap: 18px; max-width: 1200px; margin: 0 auto; padding: 0; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.nn-carrousels-looks-shoppables__piste::-webkit-scrollbar { display: none; }
.nn-carrousels-looks-shoppables__look { flex: 0 0 min(85%, 560px); scroll-snap-align: start; }
.nn-carrousels-looks-shoppables__photo { position: relative; aspect-ratio: 4 / 5; border-radius: 18px; background: linear-gradient(160deg, #E7E1D6, #B9AE9C); }
.nn-carrousels-looks-shoppables__photo > img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.nn-carrousels-looks-shoppables__point { position: absolute; transform: translate(-50%, -50%); z-index: 1; }
.nn-carrousels-looks-shoppables__point.est-ouvert { z-index: 3; }
.nn-carrousels-looks-shoppables__point button { position: relative; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--nn-accent); color: #151515; font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }
.nn-carrousels-looks-shoppables__point button::before { content: ""; position: absolute; inset: -6px; border: 2px solid var(--nn-accent); border-radius: 50%; animation: nn-carrousels-looks-shoppables-pulse 1.8s ease-out infinite; }
.nn-carrousels-looks-shoppables__point button span { transition: transform 0.25s; }
.nn-carrousels-looks-shoppables__point.est-ouvert button span { transform: rotate(45deg); }
.nn-carrousels-looks-shoppables__point button:focus-visible { outline: 2px solid #151515; outline-offset: 3px; }
.nn-carrousels-looks-shoppables__fiche { position: absolute; top: 42px; left: 0; transform: translateX(var(--nn-cote, 0%)); display: flex; align-items: center; gap: 10px; width: 230px; padding: 10px; border-radius: 14px; background: #FFFFFF; color: #151515; text-decoration: none; box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.45); }
.nn-carrousels-looks-shoppables__fiche img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex: none; }
.nn-carrousels-looks-shoppables__fiche strong { display: block; font-size: 14px; line-height: 1.3; }
.nn-carrousels-looks-shoppables__fiche em { font-style: normal; opacity: 0.7; font-size: 13px; }
.nn-carrousels-looks-shoppables__legende { margin: 10px 4px 0; font-weight: 600; }
@keyframes nn-carrousels-looks-shoppables-pulse { from { opacity: 0.9; transform: scale(0.8); } to { opacity: 0; transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) {
  .nn-carrousels-looks-shoppables *, .nn-carrousels-looks-shoppables *::before, .nn-carrousels-looks-shoppables *::after { animation: none !important; transition: none !important; }
  .nn-carrousels-looks-shoppables__piste { scroll-behavior: auto; }
}
{% endstylesheet %}

{% javascript %}
(function () {
  function brancher(racine) {
    if (racine.dataset.nnPret) return;
    racine.dataset.nnPret = "1";
    var piste = racine.querySelector("[data-nn-piste]");
    if (!piste) return;
    var points = [].slice.call(racine.querySelectorAll(".nn-carrousels-looks-shoppables__point"));
    // Ferme toutes les mini-fiches ouvertes
    function fermer() {
      points.forEach(function (p) { p.classList.remove("est-ouvert"); p.querySelector("button").setAttribute("aria-expanded", "false"); p.querySelector("a").hidden = true; });
    }
    points.forEach(function (p) {
      var btn = p.querySelector("button");
      btn.addEventListener("click", function (e) {
        e.stopPropagation();
        var ouvrir = !p.classList.contains("est-ouvert");
        fermer();
        if (ouvrir) { p.classList.add("est-ouvert"); btn.setAttribute("aria-expanded", "true"); p.querySelector("a").hidden = false; }
      });
    });
    document.addEventListener("click", function (e) { if (!racine.contains(e.target)) fermer(); });
    racine.addEventListener("keydown", function (e) { if (e.key === "Escape") fermer(); });
    // Flèches : une photo à la fois
    function pas() { var l = piste.querySelector(".nn-carrousels-looks-shoppables__look"); return l ? l.getBoundingClientRect().width + 18 : 400; }
    racine.querySelector("[data-nn-suiv]").addEventListener("click", function () { fermer(); piste.scrollBy({ left: pas() }); });
    racine.querySelector("[data-nn-prec]").addEventListener("click", function () { fermer(); piste.scrollBy({ left: -pas() }); });
  }
  function tout() { document.querySelectorAll(".nn-carrousels-looks-shoppables").forEach(brancher); }
  tout();
  document.addEventListener("shopify:section:load", tout);
})();
{% endjavascript %}
Télécharger le fichier .liquid

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 : « Carrousel de looks à acheter » (Carrousels)
Description : Diapositives de photos d’ambiance avec des points cliquables posés sur les produits : chaque point ouvre une mini-fiche (image, prix, lien) ; flèches, glisser et clavier.
Page de l’élément (aperçu en direct) : https://ai.nahnah.shop/bibliotheque-shopify/carrousels-looks-shoppables
Fichier : nahnah-carrousels-looks-shoppables.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-carrousels-looks-shoppables.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-carrousels-looks-shoppables ».
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 : carrousels-looks-shoppables).

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

  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-carrousels-looks-shoppables ».
  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.

Installer via le MCP

Depuis Claude, Claude Code ou ChatGPT connecté à NAHNAH AI, demande : « Donne-moi le code de l’élément carrousels-looks-shoppables 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

Dans la même catégorie