Build with Alpine.js in Webflow

2025-10-06 17:33:27 0
Web Development

Use Webflow to create anything and avoid spending time explaining to GPT how to use the code correctly.


I'm utilizing Webflow as my front-end development platform and need to incorporate Alpine.js functionality.

Please adhere to these constraints: Avoid using attributes that begin with "@", ":", "$", "{", or any functions within the HTML code. You may only implement logic directly in the HTML markup using "x-data", "x-init", and "x-show" attributes. Functions should not be embedded inside the HTML.

Refrain from including <!DOCTYPE html> or tags in your response.

REQUIRED STRUCTURE Provide code output for the section (omitting and tags), the <Body> section, and the <script> section.</p> <p>Format your response as markup for straightforward copying.</p> <p>When referencing the Alpine.js source, please use: https://cdn.jsdelivr.net/npm/alpinejs@3.12.0/dist/cdn.min.js</p> <p>Compose all output in [LANGUAGE]. With that established, here is the specific issue I need to resolve: [TOPIC]</p> </section> <section class="tab-pane fade" id="pane-tools" role="tabpanel"> Instructions: Replace `[LANGUAGE]` with your target language (e.g., English) and `[TOPIC]` with your article subject (e.g., 'How to Start a Successful Blog'). </section> </div> <nav class="mt-4 pt-3 border-top"> <div class="row g-3 align-items-start"> <div class="col-12 col-md-6 small d-flex align-items-center gap-2"> <i class="fa-solid fa-arrow-left-long text-muted"></i> <span class="pn-item"><a href='/software-engineering/web-development/design-patterns-in-any-language.html'>Design Patterns in any language</a></span> </div> <div class="col-12 col-md-6 small d-flex align-items-center justify-content-md-end gap-2"> <span class="pn-item"><a href='/software-engineering/web-development/the-best-name-of-variable.html'>The best name of variable</a></span> <i class="fa-solid fa-arrow-right-long text-muted"></i> </div> </div> </nav> </div> </article> </div> <aside class="col-12 col-lg-4"> <div class="card shadow-sm border-0"> <div class="card-header py-3"> <h5 class="card-title mb-0">Related Providers</h5> </div> <div class="list-group list-group-flush"> <a href="/software-engineering/web-development/in-english-ariel-code-expert.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> I </span> <div class="flex-grow-1"> <div class="fw-semibold">In English, Ariel: Code Expert</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/deobfuscate-js-code.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> D </span> <div class="flex-grow-1"> <div class="fw-semibold">Deobfuscate JS code</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/python-code-explainer.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> P </span> <div class="flex-grow-1"> <div class="fw-semibold">Python code explainer</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/snippet-for-wordpress.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> S </span> <div class="flex-grow-1"> <div class="fw-semibold">Snippet for WordPress</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/best-programming-summarizer-ever.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> B </span> <div class="flex-grow-1"> <div class="fw-semibold">Best programming summarizer ever</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/python-bug-fix-prompt.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> P </span> <div class="flex-grow-1"> <div class="fw-semibold">Python Bug Fix Prompt</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/pull-request-creator.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> P </span> <div class="flex-grow-1"> <div class="fw-semibold">Pull request creator</div> <div class="text-muted small text-truncate-2"></div> </div> </a> <a href="/software-engineering/web-development/websites-scraping-and-automation.html" class="list-group-item list-group-item-action d-flex gap-3"> <span class="d-inline-flex align-items-center justify-content-center rounded-3 text-white fw-bold flex-shrink-0" style="width:36px;height:36px;background:#6c757d;"> W </span> <div class="flex-grow-1"> <div class="fw-semibold">Websites scraping and automation</div> <div class="text-muted small text-truncate-2"></div> </div> </a> </div> </div> </aside> </div> </div> </main> <style> :root{ --bs-background:#ffffff; --bs-primary:#0d6efd; --bs-primary-foreground:#ffffff; --bs-muted-foreground:#6c757d; } .bg-background{background-color:var(--bs-background)!important;} .text-primary-foreground{color:var(--bs-primary-foreground)!important;} .text-muted-foreground{color:var(--bs-muted-foreground)!important;} .h-8{height:2rem}.w-8{width:2rem} .footer-social-icon{font-size:1rem;transition:color .2s;} .footer-social-icon:hover{color:#212529!important;} </style> <!-- Footer Section (Optimized, with Email) --> <footer class="border-top bg-background"> <div class="container mx-auto px-4 py-5 py-md-5 py-lg-6"> <div class="border-top mt-5 pt-4 d-flex flex-column flex-md-row justify-content-between align-items-center"> <!-- 左侧版权信息 --> <p class="text-sm text-muted-foreground mb-3 mb-md-0"> © 2025 Ray Prompt </p> <!-- 中间标语 --> <p class="text-sm text-muted-foreground mb-3 mb-md-0"> Made with ❤️ for the community </p> <!-- 右侧 Email --> <p class="text-sm text-muted-foreground mb-0"> Email: <a href="mailto:ray@rayprompt.com" class="text-dark"> ray@rayprompt.com </a> </p> </div> </div> </footer> <!-- Bootstrap 5 JS Bundle (Popper included) CDN --> <script src="/skin/default/js/bootstrap.bundle.min.js" defer></script> <script src="/skin/default/js/nav.js" defer></script> <!-- Custom JS for mobile menu toggle --> <script> document.addEventListener('DOMContentLoaded', function() { // =================================================================== // 1. 保留原有导航栏鼠标悬停效果 // =================================================================== if (window.innerWidth > 992) { document.querySelectorAll('.navbar .nav-item.dropdown').forEach(function(everyitem) { everyitem.addEventListener('mouseover', function(e) { let el_link = this.querySelector('a[data-bs-toggle], button[data-bs-toggle]'); if (el_link) { let nextEl = el_link.nextElementSibling; if (nextEl && nextEl.classList.contains('dropdown-menu')) { el_link.classList.add('show'); nextEl.classList.add('show'); } } }); everyitem.addEventListener('mouseleave', function(e) { let el_link = this.querySelector('a[data-bs-toggle], button[data-bs-toggle]'); if (el_link) { let nextEl = el_link.nextElementSibling; if (nextEl && nextEl.classList.contains('dropdown-menu')) { el_link.classList.remove('show'); nextEl.classList.remove('show'); } } }) }); } // =================================================================== // 2. 侧边栏导航交互逻辑 // =================================================================== const sidebarNav = document.querySelector('.sidebar .category-list'); if (sidebarNav) { const subLinks = sidebarNav.querySelectorAll('.collapse .list-group-item'); subLinks.forEach(function(link) { link.addEventListener('click', function(event) { event.stopPropagation(); }); }); const currentLocation = window.location.href.split('?')[0].split('#')[0]; const allLinks = sidebarNav.querySelectorAll('a.category-link, .collapse a.list-group-item'); let bestMatch = null; let longestMatchLength = 0; allLinks.forEach(link => { if (link.href) { const cleanLinkHref = link.href.split('?')[0].split('#')[0]; if (currentLocation.startsWith(cleanLinkHref) && cleanLinkHref.length > longestMatchLength) { longestMatchLength = cleanLinkHref.length; bestMatch = link; } } }); if (bestMatch) { bestMatch.classList.add('active'); const parentCollapse = bestMatch.closest('.collapse'); if (parentCollapse) { new bootstrap.Collapse(parentCollapse, { toggle: false }).show(); const parentToggler = document.querySelector(`a.collapse-toggle[href="#${parentCollapse.id}"]`); if (parentToggler) { parentToggler.classList.add('active-parent'); parentToggler.setAttribute('aria-expanded', 'true'); const parentCategoryLink = parentToggler.closest('.list-group-item').querySelector('a.category-link'); if(parentCategoryLink) { parentCategoryLink.classList.add('active-parent'); } } } } const allCollapseElements = sidebarNav.querySelectorAll('.collapse'); allCollapseElements.forEach(collapseEl => { collapseEl.addEventListener('show.bs.collapse', event => { allCollapseElements.forEach(otherCollapseEl => { if (otherCollapseEl !== event.target) { const instance = bootstrap.Collapse.getInstance(otherCollapseEl); if (instance) { instance.hide(); } } }); }); }); } }); </script> </body> </html>