Basics 2A - Apply
This is a responsive 2-carousel layout that is useful for listing content in a “menu” carousel and viewing content in a “main” carousel.
You can swipe left or right on the title bar to turn the respective carousel.
Usage:
-
Add CSS with media query for portrait:
<style>
#container1 {
top: 0;
left: 0;
width: 60%;
height: 100%;
}
#container2 {
top: 0;
left: 60%;
width: 40%;
height: 100%;
}
@media (orientation: portrait) {
#container1 {
top: 0;
left: 0;
width: 100%;
height: 60%;
}
#container2 {
top: 60%;
left: 0;
width: 100%;
height: 40%;
}
}
</style>
-
Add HTML structure for two carousels:
<section class="panther-Carousels">
<!-- Carousel 1 -->
<section id="container1" class="panther-Carousel-container">
<div id="carousel1" class="panther-Carousel-carousel">
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< Carousel 1 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 1: Add your content here -->
</div>
</figure>
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< 2 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 2: Add your content here -->
</div>
</figure>
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< 3 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 3: Add your content here -->
</div>
</figure>
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< 4 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 4: Add your content here -->
</div>
</figure>
</div>
</section>
<!-- Carousel 2 -->
<section id="container2" class="panther-Carousel-container">
<div id="carousel2" class="panther-Carousel-carousel">
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< Carousel 2 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 1: Add your content here -->
</div>
</figure>
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< 2 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 2: Add your content here -->
</div>
</figure>
<figure>
<div class="panther-Carousel-panelTitleBar"><span class="panther-Carousel-panelTitle">< 3 ></span></div>
<div class="panther-Carousel-panelContent">
<!-- Panel 3: Add your content here -->
</div>
</figure>
</div>
</section>
</section>
-
Bind events to control the first carousel using the turnTo method:
<input type="button" value="1" onclick="Panther.Carousel.turnTo('carousel1', 1);">
<input type="button" value="2" onclick="Panther.Carousel.turnTo('carousel1', 2);">
<input type="button" value="3" onclick="Panther.Carousel.turnTo('carousel1', 3);">
<input type="button" value="4" onclick="Panther.Carousel.turnTo('carousel1', 4);">
-
Add JavaScript to initialize the carousels:
<script>
// Initialize carousels
Panther.Carousel.init({
id: 'carousel1',
backgroundColor: 'rgba(0, 152, 240, 0.9)' // blue
});
Panther.Carousel.init({
id: 'carousel2',
backgroundColor: 'rgba(150, 184, 0, 0.9)' // green
});
</script>