|
|
| (One intermediate revision by the same user not shown) |
| Line 1: |
Line 1: |
| <includeonly><div class="carousel-container" style="width: {{{width|400}}}px; margin: 1em auto; font-family: sans-serif;"> | | <includeonly><gallery mode="{{{mode|slideshow}}}" widths="{{{width|400}}}px" heights="{{{height|300}}}px"> |
| <div class="carousel-wrapper" style="position: relative; width: 100%; height: {{{height|300}}}px; overflow: hidden; background-color: #1a1a1a; border-radius: 8px;">
| | File:{{{image1|}}} |
| <div class="carousel-slides" id="carousel-{{REVISIONID}}" style="display: flex; transition: transform 0.5s ease-in-out; height: 100%;">
| | {{#if:{{{image2|}}}|File:{{{image2}}}}} |
| {{#if: {{{image1|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;">
| | {{#if:{{{image3|}}}|File:{{{image3}}}}} |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image1}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| | {{#if:{{{image4|}}}|File:{{{image4}}}}} |
| {{#if: {{{text1|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text1}}}</div>}}
| | {{#if:{{{image5|}}}|File:{{{image5}}}}} |
| </div>}}
| | {{#if:{{{image6|}}}|File:{{{image6}}}}} |
| {{#if: {{{image2|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | | {{#if:{{{image7|}}}|File:{{{image7}}}}} |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image2}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| | {{#if:{{{image8|}}}|File:{{{image8}}}}} |
| {{#if: {{{text2|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text2}}}</div>}}
| | {{#if:{{{image9|}}}|File:{{{image9}}}}} |
| </div>}}
| | {{#if:{{{image10|}}}|File:{{{image10}}}}} |
| {{#if: {{{image3|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | | {{#if:{{{image11|}}}|File:{{{image11}}}}} |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image3}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| | {{#if:{{{image12|}}}|File:{{{image12}}}}} |
| {{#if: {{{text3|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text3}}}</div>}}
| | </gallery>{{#if:{{{header|}}}| |
| </div>}}
| | <p style="text-align:center; font-size:18px; font-weight:bold; margin-top:10px;">{{{header}}}</p>}}{{#if:{{{description|}}}| |
| {{#if: {{{image4|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | | <p style="text-align:center; font-size:14px; color:#54595d; margin-top:5px;">{{{description}}}</p>}}</includeonly><noinclude> |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image4}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text4|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text4}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image5|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image5}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text5|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text5}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image6|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image6}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text6|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text6}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image7|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image7}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text7|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text7}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image8|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image8}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text8|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text8}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image9|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image9}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text9|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text9}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image10|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image10}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text10|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text10}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image11|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image11}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text11|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text11}}}</div>}}
| |
| </div>}}
| |
| {{#if: {{{image12|}}}|<div class="carousel-slide" style="min-width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;"> | |
| <div style="flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; overflow: hidden;">[[File:{{{image12}}}|{{{width|400}}}x{{{height|300}}}px|center|link=]]</div>
| |
| {{#if: {{{text12|}}}|<div style="position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,0.8)); color: #fff; padding: 20px 10px 10px; text-align: center; font-size: 14px;">{{{text12}}}</div>}}
| |
| </div>}} | |
| </div>
| |
| <button class="carousel-btn carousel-prev" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');var s=c.querySelectorAll('.carousel-slide').length;var i=parseInt(c.dataset.index||0);i=(i-1+s)%s;c.style.transform='translateX(-'+i*100+'%)';c.dataset.index=i;})();" style="position: absolute; top: 50%; left: 10px; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;">❮</button>
| |
| <button class="carousel-btn carousel-next" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');var s=c.querySelectorAll('.carousel-slide').length;var i=parseInt(c.dataset.index||0);i=(i+1)%s;c.style.transform='translateX(-'+i*100+'%)';c.dataset.index=i;})();" style="position: absolute; top: 50%; right: 10px; transform: translateY(-50%); background: rgba(0,0,0,0.5); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center;">❯</button>
| |
| <div class="carousel-dots" style="position: absolute; bottom: {{#if: {{{text1|}}}|50|10}}px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px;">
| |
| {{#if: {{{image1|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(0%)';c.dataset.index=0;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image2|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-100%)';c.dataset.index=1;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image3|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-200%)';c.dataset.index=2;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image4|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-300%)';c.dataset.index=3;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image5|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-400%)';c.dataset.index=4;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image6|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-500%)';c.dataset.index=5;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image7|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-600%)';c.dataset.index=6;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image8|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-700%)';c.dataset.index=7;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image9|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-800%)';c.dataset.index=8;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image10|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-900%)';c.dataset.index=9;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image11|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-1000%)';c.dataset.index=10;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| {{#if: {{{image12|}}}|<span class="carousel-dot" onclick="(function(){var c=document.getElementById('carousel-{{REVISIONID}}');c.style.transform='translateX(-1100%)';c.dataset.index=11;})();" style="width: 10px; height: 10px; background: rgba(255,255,255,0.7); border-radius: 50%; cursor: pointer;"></span>}}
| |
| </div>
| |
| </div>
| |
| {{#if: {{{header|}}}|<div class="carousel-header" style="text-align: center; font-size: 18px; font-weight: bold; margin-top: 10px; color: #202122;">{{{header}}}</div>}}
| |
| {{#if: {{{description|}}}|<div class="carousel-description" style="text-align: center; font-size: 14px; color: #54595d; margin-top: 5px;">{{{description}}}</div>}} | |
| {{#ifeq: {{{auto|}}}|yes|<script>
| |
| (function(){
| |
| var c=document.getElementById('carousel-{{REVISIONID}}');
| |
| var s=c.querySelectorAll('.carousel-slide').length;
| |
| setInterval(function(){
| |
| var i=parseInt(c.dataset.index||0);
| |
| i=(i+1)%s;
| |
| c.style.transform='translateX(-'+i*100+'%)';
| |
| c.dataset.index=i;
| |
| },{{{delay|5000}}});
| |
| })();
| |
| </script>}}
| |
| </div></includeonly><noinclude>
| |
| {{documentation}} | | {{documentation}} |
| | |
| | == Usage == |
| | <pre> |
| | {{Carousel |
| | |mode = slideshow |
| | |width = 500 |
| | |height = 350 |
| | |image1 = Screenshot1.png |
| | |image2 = Screenshot2.png |
| | |image3 = Screenshot3.png |
| | |header = My Gallery |
| | |description = Some description text |
| | }} |
| | </pre> |
| | |
| | == Modes == |
| | * '''slideshow''' - Slideshow with navigation arrows (default) |
| | * '''traditional''' - Thumbnail grid |
| | * '''packed''' - Justified layout |
| | * '''nolines''' - Grid without borders |
|
| |
|
| <templatedata> | | <templatedata> |
| { | | { |
| "description": "An image carousel/slideshow template. Displays up to 12 images with navigation arrows, dot indicators, and optional captions. Supports auto-play.", | | "description": "Image carousel using MediaWiki's native gallery slideshow.", |
| "params": { | | "params": { |
| | "mode": { |
| | "label": "Mode", |
| | "description": "Display mode", |
| | "type": "string", |
| | "default": "slideshow", |
| | "suggestedvalues": ["slideshow", "traditional", "packed", "nolines"] |
| | }, |
| "width": { | | "width": { |
| "label": "Width", | | "label": "Width", |
| "description": "Width of the carousel in pixels",
| |
| "type": "number", | | "type": "number", |
| "default": "400" | | "default": "400" |
| Line 97: |
Line 55: |
| "height": { | | "height": { |
| "label": "Height", | | "label": "Height", |
| "description": "Height of the carousel in pixels",
| |
| "type": "number", | | "type": "number", |
| "default": "300" | | "default": "300" |
| }, | | }, |
| "auto": {
| | "image1": { "label": "Image 1", "type": "wiki-file-name", "required": true }, |
| "label": "Auto-play",
| |
| "description": "Enable automatic slideshow (yes/no)",
| |
| "type": "string",
| |
| "suggestedvalues": ["yes", "no"],
| |
| "default": "no"
| |
| },
| |
| "delay": {
| |
| "label": "Auto-play Delay",
| |
| "description": "Delay between slides in milliseconds (only if auto=yes)",
| |
| "type": "number",
| |
| "default": "5000"
| |
| },
| |
| "image1": { | |
| "label": "Image 1",
| |
| "description": "First image filename",
| |
| "type": "wiki-file-name",
| |
| "required": true
| |
| },
| |
| "text1": {
| |
| "label": "Caption 1",
| |
| "description": "Caption for first image",
| |
| "type": "string"
| |
| },
| |
| "image2": { "label": "Image 2", "type": "wiki-file-name" }, | | "image2": { "label": "Image 2", "type": "wiki-file-name" }, |
| "text2": { "label": "Caption 2", "type": "string" },
| |
| "image3": { "label": "Image 3", "type": "wiki-file-name" }, | | "image3": { "label": "Image 3", "type": "wiki-file-name" }, |
| "text3": { "label": "Caption 3", "type": "string" },
| |
| "image4": { "label": "Image 4", "type": "wiki-file-name" }, | | "image4": { "label": "Image 4", "type": "wiki-file-name" }, |
| "text4": { "label": "Caption 4", "type": "string" },
| |
| "image5": { "label": "Image 5", "type": "wiki-file-name" }, | | "image5": { "label": "Image 5", "type": "wiki-file-name" }, |
| "text5": { "label": "Caption 5", "type": "string" },
| |
| "image6": { "label": "Image 6", "type": "wiki-file-name" }, | | "image6": { "label": "Image 6", "type": "wiki-file-name" }, |
| "text6": { "label": "Caption 6", "type": "string" },
| |
| "image7": { "label": "Image 7", "type": "wiki-file-name" }, | | "image7": { "label": "Image 7", "type": "wiki-file-name" }, |
| "text7": { "label": "Caption 7", "type": "string" },
| |
| "image8": { "label": "Image 8", "type": "wiki-file-name" }, | | "image8": { "label": "Image 8", "type": "wiki-file-name" }, |
| "text8": { "label": "Caption 8", "type": "string" },
| |
| "image9": { "label": "Image 9", "type": "wiki-file-name" }, | | "image9": { "label": "Image 9", "type": "wiki-file-name" }, |
| "text9": { "label": "Caption 9", "type": "string" },
| |
| "image10": { "label": "Image 10", "type": "wiki-file-name" }, | | "image10": { "label": "Image 10", "type": "wiki-file-name" }, |
| "text10": { "label": "Caption 10", "type": "string" },
| |
| "image11": { "label": "Image 11", "type": "wiki-file-name" }, | | "image11": { "label": "Image 11", "type": "wiki-file-name" }, |
| "text11": { "label": "Caption 11", "type": "string" },
| |
| "image12": { "label": "Image 12", "type": "wiki-file-name" }, | | "image12": { "label": "Image 12", "type": "wiki-file-name" }, |
| "text12": { "label": "Caption 12", "type": "string" },
| | "header": { "label": "Header", "type": "string" }, |
| "header": { | | "description": { "label": "Description", "type": "string" } |
| "label": "Header",
| |
| "description": "Optional header text below the carousel",
| |
| "type": "string"
| |
| },
| |
| "description": { | |
| "label": "Description",
| |
| "description": "Optional description text below the header",
| |
| "type": "string"
| |
| }
| |
| }, | | }, |
| "paramOrder": [
| |
| "width", "height", "auto", "delay",
| |
| "image1", "text1", "image2", "text2", "image3", "text3",
| |
| "image4", "text4", "image5", "text5", "image6", "text6",
| |
| "image7", "text7", "image8", "text8", "image9", "text9",
| |
| "image10", "text10", "image11", "text11", "image12", "text12",
| |
| "header", "description"
| |
| ],
| |
| "format": "block" | | "format": "block" |
| } | | } |