HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<section class="mt-5">
<div class="container">
<h1>About Tanzania </h1>
<p>Tanzania, officially the United Republic of Tanzania, is a country in East Africa within the African Great Lakes region. It borders Uganda to the north; Kenya to the northeast; Comoro Islands and the Indian Ocean to the east; Mozambique and Malawi to the south; Zambia to the southwest; and Rwanda, Burundi, and the Democratic Republic of the Congo to the west. Mount Kilimanjaro, Africa's highest mountain, is in northeastern Tanzania.</p>
</div>
</section>
<section class="section-with-carousel section-with-right-offset position-relative mt-5">
<div class="container">
<h2 class="mb-3">Tanzania Through Photos</h2>
</div>
<div class="carousel-wrapper">
<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<figure>
<img width="640" height="480" src="https://assets.codepen.io/162656/tanzania1.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Nungwi, Zanzibar, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania2.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Ngorongoro Crater, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania3.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania4.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Serengeti, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania5.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Lushoto District, Tanga Region, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="480" src="https://assets.codepen.io/162656/tanzania6.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Serengeti, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania7.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Serengeti National Park, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania8.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Tarangire National Park, Arusha, Tanzania
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div class="carousel-controls">
<button class="carousel-control carousel-control-left" type="button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40">
<path fill-rule="evenodd" d="M10.78 19.03a.75.75 0 01-1.06 0l-6.25-6.25a.75.75 0 010-1.06l6.25-6.25a.75.75 0 111.06 1.06L5.81 11.5h14.44a.75.75 0 010 1.5H5.81l4.97 4.97a.75.75 0 010 1.06z"></path>
</svg>
</button>
<button class="carousel-control carousel-control-right" type="button">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40">
<path fill-rule="evenodd" d="M13.22 19.03a.75.75 0 001.06 0l6.25-6.25a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 10-1.06 1.06l4.97 4.97H3.75a.75.75 0 000 1.5h14.44l-4.97 4.97a.75.75 0 000 1.06z"></path>
</svg>
</button>
</div>
<div class="swiper-pagination"></div>
</section>
<section class="mt-5">
<div class="container">
<h2 class="mb-3">
Wildlife and conservation
</h2>
<p>Tanzania contains around 20% of the species of Africa's enormous warm-blooded animal populace, found over its 21 National parks, reserves, 1 conservation area, and 3 marine parks. Spread over a zone of in excess of 42,000 square kilometres (16,000 sq. mi) and shaping around 38% of the nation's area. Tanzania has 21 national parks, plus a variety of game and forest reserves, including the Ngorongoro Conservation Area. In western Tanzania, Gombe Stream National Park is the site of Jane Goodall's ongoing study of chimpanzee behaviour, which started in 1960.</p>
</div>
</section>
<section class="section-with-carousel section-with-left-offset position-relative mt-5">
<div class="container">
<h2 class="mb-3">Tanzania Through Photos</h2>
</div>
<div class="carousel-wrapper">
<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<figure>
<img width="640" height="480" src="https://assets.codepen.io/162656/tanzania1.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Nungwi, Zanzibar, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania2.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Ngorongoro Crater, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania3.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania4.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Serengeti, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania5.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Lushoto District, Tanga Region, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="480" src="https://assets.codepen.io/162656/tanzania6.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Serengeti, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania7.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Serengeti National Park, Tanzania
</figcaption>
</figure>
</div>
<div class="swiper-slide">
<figure>
<img width="640" height="427" src="https://assets.codepen.io/162656/tanzania8.jpg" alt="">
<figcaption>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20">
<path d="M12 13.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z"></path>
<path fill-rule="evenodd" d="M19.071 3.429C15.166-.476 8.834-.476 4.93 3.429c-3.905 3.905-3.905 10.237 0 14.142l.028.028 5.375 5.375a2.359 2.359 0 003.336 0l5.403-5.403c3.905-3.905 3.905-10.237 0-14.142zM5.99 4.489A8.5 8.5 0 0118.01 16.51l-5.403 5.404a.859.859 0 01-1.214 0l-5.378-5.378-.002-.002-.023-.024a8.5 8.5 0 010-12.02z"></path>
</svg>
Tarangire National Park, Arusha, Tanzania
</figcaption>
</figure>
</div>
</div>
</div>
</div>
<div class="carousel-controls">
<div class="carousel-control carousel-control-left">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40">
<path fill-rule="evenodd" d="M10.78 19.03a.75.75 0 01-1.06 0l-6.25-6.25a.75.75 0 010-1.06l6.25-6.25a.75.75 0 111.06 1.06L5.81 11.5h14.44a.75.75 0 010 1.5H5.81l4.97 4.97a.75.75 0 010 1.06z"></path>
</svg>
</div>
<div class="carousel-control carousel-control-right">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="40" height="40">
<path fill-rule="evenodd" d="M13.22 19.03a.75.75 0 001.06 0l6.25-6.25a.75.75 0 000-1.06l-6.25-6.25a.75.75 0 10-1.06 1.06l4.97 4.97H3.75a.75.75 0 000 1.5h14.44l-4.97 4.97a.75.75 0 000 1.06z"></path>
</svg>
</div>
</div>
<div class="swiper-pagination"></div>
</section>
<section class="copyright my-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-auto">
<p class="mb-0">Images from <a href="https://unsplash.com/" target="_blank">Unsplash</a></p>
</div>
<div class="col-auto">
<p class="mb-0">Cursor icon from <a href="https://uxwing.com/slide-left-right-icon" target="_blank">UXWing</a></p>
</div>
<div class="col-auto">
<p class="mb-0">Text from <a href="https://en.wikipedia.org/wiki/Tanzania" target="_blank">Wikipedia</a></p>
</div>
</div>
</div>
</section>
<div class="cursor">
<img width="40" height="42" src="https://assets.codepen.io/162656/cursor-swipe.svg" alt="swipe indicator">
</div>
<footer class="page-footer">
<span>made by </span>
<a href="https://georgemartsoukos.com/" target="_blank">
<img width="24" height="24" src="https://assets.codepen.io/162656/george-martsoukos-small-logo.svg" alt="George Martsoukos logo">
</a>
</footer>
/* RESET STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
button {
border: none;
background: none;
}
a,
a:hover {
color: inherit;
}
figure {
margin: 0;
}
/* MAIN STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.container {
max-width: 1100px;
}
.section-with-carousel .swiper-slide figure {
position: relative;
overflow: hidden;
}
.section-with-carousel .swiper-slide img {
width: 100%;
height: 320px;
object-fit: cover;
}
.section-with-carousel .swiper-slide figcaption {
position: absolute;
bottom: 0;
left: 0;
right: 0;
transform: translateY(20%);
display: flex;
align-items: baseline;
justify-content: center;
padding: 20px;
text-align: center;
opacity: 0;
visibility: hidden;
color: white;
background: rgba(0, 0, 0, 0.5);
transition: all 0.4s;
}
.section-with-carousel .swiper-slide figcaption svg {
flex-shrink: 0;
fill: white;
margin-right: 10px;
}
.section-with-carousel .swiper-slide-active figcaption {
opacity: 1;
visibility: visible;
transform: none;
}
.section-with-carousel .carousel-controls {
position: absolute;
top: 50%;
left: 0;
right: 0;
transform: translateY(-50%);
display: flex;
justify-content: space-between;
padding: 0 12px;
z-index: 1;
}
.section-with-carousel .carousel-controls .carousel-control {
opacity: 0.25;
transition: opacity 0.3s;
}
.section-with-carousel .carousel-controls .carousel-control:hover {
opacity: 1;
}
.section-with-carousel .swiper-pagination-bullets {
position: static;
display: flex;
justify-content: center;
margin-top: 10px;
}
.section-with-carousel .swiper-pagination-bullets .swiper-pagination-bullet {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: auto;
height: auto;
background: transparent;
opacity: 0.5;
margin: 0 8px;
border-radius: 0;
transition: opacity 0.3s;
}
.section-with-carousel
.swiper-pagination-bullets
.swiper-pagination-bullet
.line {
width: 3px;
height: 3px;
background: black;
transition: transform 0.3s;
}
.section-with-carousel
.swiper-pagination-bullets
.swiper-pagination-bullet
.number {
opacity: 0;
transform: translateY(-7px);
transition: all 0.3s;
}
.section-with-carousel
.swiper-pagination-bullets
.swiper-pagination-bullet.swiper-pagination-bullet-active {
opacity: 1;
}
.section-with-carousel
.swiper-pagination-bullets
.swiper-pagination-bullet.swiper-pagination-bullet-active
.line {
transform: scaleX(8);
}
.section-with-carousel
.swiper-pagination-bullets
.swiper-pagination-bullet.swiper-pagination-bullet-active
.number {
opacity: 1;
transform: none;
}
.copyright .col-auto:not(:last-child) {
position: relative;
}
.copyright .col-auto:not(:last-child)::before {
content: "•";
position: absolute;
top: 50%;
right: -2px;
transform: translateY(-50%);
}
@media (min-width: 768px) {
.section-with-carousel .swiper-slide img {
height: 370px;
}
}
@media (min-width: 1200px) {
.section-with-carousel .swiper-slide img {
height: 420px;
}
.section-with-carousel .carousel-controls {
padding: 0 50px;
}
}
/* CURSOR STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
@media (hover: hover) {
.section-with-carousel .carousel-wrapper {
cursor: none;
}
.section-with-carousel .carousel-controls .carousel-control {
position: absolute;
top: 50%;
transform: translateY(-50%);
z-index: 1;
}
.section-with-carousel .carousel-controls .carousel-control-left {
left: 50px;
}
.section-with-carousel .carousel-controls .carousel-control-right {
right: 50px;
}
.cursor {
position: fixed;
left: var(--cursor-x);
top: var(--cursor-y);
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
color: white;
background: black;
border-radius: 50%;
transform: translate(-50%, -50%) scale(0);
z-index: 1;
pointer-events: none;
opacity: 0;
transition: opacity 0.2s, transform 0.2s;
}
body.show-custom-cursor .cursor {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
}
/* FOOTER STYLES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
position: fixed;
right: 0;
bottom: 50px;
display: flex;
align-items: center;
padding: 5px;
z-index: 1;
background: white;
}
.page-footer a {
display: flex;
margin-left: 4px;
}
/*SLIDERS FUNCTIONALITY*/
const sectionsWithCarousel = document.querySelectorAll(
".section-with-carousel"
);
createOffsets();
window.addEventListener("resize", createOffsets);
function createOffsets() {
const sectionWithLeftOffset = document.querySelector(
".section-with-left-offset"
);
const sectionWithLeftOffsetCarouselWrapper = sectionWithLeftOffset.querySelector(
".carousel-wrapper"
);
const sectionWithRightOffset = document.querySelector(
".section-with-right-offset"
);
const sectionWithRightOffsetCarouselWrapper = sectionWithRightOffset.querySelector(
".carousel-wrapper"
);
const offset = (window.innerWidth - 1100) / 2;
const mqLarge = window.matchMedia("(min-width: 1200px)");
if (sectionWithLeftOffset && mqLarge.matches) {
sectionWithLeftOffsetCarouselWrapper.style.marginLeft = offset + "px";
} else {
sectionWithLeftOffsetCarouselWrapper.style.marginLeft = 0;
}
if (sectionWithRightOffset && mqLarge.matches) {
sectionWithRightOffsetCarouselWrapper.style.marginRight = offset + "px";
} else {
sectionWithRightOffsetCarouselWrapper.style.marginRight = 0;
}
}
for (const section of sectionsWithCarousel) {
let slidesPerView = [1.5, 2.5, 3.5];
if (section.classList.contains("section-with-left-offset")) {
slidesPerView = [1.5, 1.5, 2.5];
}
const swiper = section.querySelector(".swiper");
new Swiper(swiper, {
slidesPerView: slidesPerView[0],
spaceBetween: 15,
loop: true,
lazyLoading: true,
keyboard: {
enabled: true
},
navigation: {
prevEl: section.querySelector(".carousel-control-left"),
nextEl: section.querySelector(".carousel-control-right")
},
pagination: {
el: section.querySelector(".swiper-pagination"),
clickable: true,
renderBullet: function (index, className) {
return `<div class=${className}>
<span class="number">${index + 1}</span>
<span class="line"></span>
</div>`;
}
},
breakpoints: {
768: {
slidesPerView: slidesPerView[1]
},
1200: {
slidesPerView: slidesPerView[2]
}
}
});
}
/*CURSOR FUNCTIONALITY*/
const cursor = document.querySelector(".cursor");
const body = document.body;
const toggleClass = "show-custom-cursor";
function pointermoveHandler(e) {
const target = e.target;
if (
e.target.closest(".carousel-wrapper") &&
window.matchMedia("(hover: hover)").matches
) {
body.classList.add(toggleClass);
cursor.style.setProperty("--cursor-x", `${e.clientX}px`);
cursor.style.setProperty("--cursor-y", `${e.clientY}px`);
} else {
body.classList.remove(toggleClass);
}
}
document.addEventListener("pointermove", pointermoveHandler);
Also see: Tab Triggers