CROQUEMBOUCHE'S TOPIA
DO NOT USE THIS COMPONENT!
It is a work in progress. At some point it will either be moved to the SCP Wiki, or deleted. Any pages that use it will break.
- rewrite in something not-terrible DONEish
- support loading images by full URL DONE
- do not autoplay if prefers-reduced-motion DONE in js but not css
- to be able to show text over the image in a contrast-friendly way
- to have information about its current state very clearly broadcasted and not just have a bunch of shitty dots at the bottom
- to be able to display a couple of different kinds of text - artist, context, links (though maybe this should be under/next to the image instead of on it)
- to be able to display multiple links
- not going big left-right swoosh all the fucking time
- extract all english strings
- progress bar for the timer (use rAF?)
- dont just post it, warn rounder first
What this is
This component is an image carousel. It's an image block that, instead of showing just one image, cycles through many.
Should you use this component?
Short answer: probably not. Use regular image blocks instead.
Longer answer:
If possible, I would recommend not using this component. Use a series of standard image blocks instead.
A carousel might be a good idea if all of the following describe your situation:
- You have several images you want to display - between three and five.
- You have a very limited amount of space.
- Your images all have roughly the same width to height ratio.
- It's fine if readers ignore your images entirely.
- It's fine if readers are irritated or distracted by the constant motion.
- You don't expect readers to want to see all of the images (as they'll have to wait to do so).
- None of the images are particularly important (because none will be on-screen for long).
Additionally, do not use this component with images that would replace textual information (for example, do not use this component to display announcements that would otherwise be plain text). That is a black hole for users who use screen readers or translators to navigate the site.
Usage
Wherever you want your Image Carousel, slap in this code instead of your standard image block.
[[include :scp-wiki:component:carousel
| images=photograph.png,old-map.png,jumpscare.gif
| caption=A selection of images.
| interval=5
| wiki=scp-wiki
| page=SCP-173
| width=300px
| height=240px
| position=right
| no-caption=false
| background=white
| options=yes
]]
Configuring
The image carousel has a lot of different parameters, so I've split them up into different sections.
Parameters for each image
The following parameters are all lists. There should be one value for each image in the carousel, separated by commas.
For example, the images parameter is a list of sources, one for each image; and the links parameter is a list of URLs, one for each image.
It's important that each list has the same amount of items in it, or the carousel might not work as expected.
| images | A list of image sources, separated by commas. These images will appear in the carousel in the order that you list them. The sources can be either full URLs or just the filenames. |
| links (Optional) |
A list of URLs for each image to link to, separated by commas. Clicking on the image will take the user to this URL. If provided, there must be the same number of URLs as there are images. |
Default values for image locations
The images parameter accepts both full URLs or just filenames. In the case of just filenames, the carousel needs to know where to find those files. If any of your image sources are just filenames, you'll need these two parameters to tell the carousel how to find them.
| wiki | The name of the wiki that the images are uploaded to. For example, scp-wiki (NOT "scpwiki") or scp-sandbox-3. |
| page | The slug of the page that the images are uploaded to. Include the category, if any. (The 'slug' is the name of the page as seen in the URL - for example, for scp-botnik-j the slug is scp-botnik-j.) |
This allows the carousel to construct its own URLs for those images.
Timing control
| interval (Optional) |
The number of seconds to wait between 'rotations' of the carousel. After this many seconds, the currently-displayed image will change to the next one in the list. If the number is 0, the carousel will never automatically rotate, but can still be manually rotated with the arrow buttons. I recommend either 0 or at least 5. Default value: 0 |
Size and position
| width (Optional) |
The width of the carousel. Default value: 300px |
| height (Optional) |
The height of the carousel. If not provided, the optimum height will be calculated based on the provided width and the average width/height of each image. Default: automatic |
| position (Optional) |
The horizontal position of the carousel on the page. left, right or center. Default value: right |
Caption
The image carousel has a single caption beneath it that looks like the caption of the standard image block. This caption cannot change based on the image that is currently displaying; it should describe the images that are in the carousel as a collective.
| caption (Optional) |
The caption that goes underneath the carousel. Default value: {$caption} |
| no-caption (Optional) |
Either true or false. If you don't want there to be a caption below the carousel, set this to true. Default value: false |
Appearance
| background (Optional) |
The background behind the images. Default value: transparent |
| style (Optional) |
Custom CSS styling to add to the inside of the carousel. You can't style the inside of the carousel with a regular CSS module - this is the only way. If you have lots of image carousels and you want them all to be styled the same way, instead of copy-pasting the CSS into each one, I recommend putting that CSS into a code block somewhere and then @importing it into each carousel. |
I want the carousel to spread across the whole page!
Set width to 100% and position to center.
I set width and height to the size of my biggest image but it's way too big!
Pick a smaller number, or make your images smaller. Or, get rid of the height parameter and let the automatic optimiser handle it.
{$caption}
Codebase
JS to operate the carousel
CSS styling for the caption box
This CSS affects the exterior of the carousel (e.g. the caption box) and can be overridden with a normal CSS module.
CSS styling for the interior
This CSS affects the interior of the carousel (e.g. the images, the transitions, the controls) and can be overridden by passing CSS to the style parameter of this component.






