Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="map-wrapper">
      <div>OPTION 1</div>
      <div>OPTION 2</div>
      <div>OPTION 3</div>
      <div>OPTION 4</div>
</div>
<div id="dropdown-wrapper">
      <h2>LABEL</h2>
      <ul class="dropdown">
            <li class="options">OPTION 1</li>
            <li class="options">OPTION 2</li>
            <li class="options">OPTION 3</li>
            <li class="options">OPTION 4</li>
      </ul>
</div>
<div class="tab-wrapper">

      <div class="tabs tab-1">
            <div class="rows">
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-2.jpg?v=1678308061">
                        </div>
                  </div>
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
            </div>
            <div class="rows">
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-2-2.jpg?v=1678308062">
                        </div>
                  </div>
            </div>
      </div>

      <div class="tabs tab-2">
            <div class="rows">
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-1.jpg?v=1678308062">
                        </div>
                  </div>
            </div>
            <div class="rows">
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-1-1.jpg?v=1678308061">
                        </div>
                  </div>
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
            </div>
      </div>

      <div class="tabs tab-3">
            <div class="rows">
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-2.jpg?v=1678308061">
                        </div>
                  </div>
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
            </div>
            <div class="rows">
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-2-2.jpg?v=1678308062">
                        </div>
                  </div>
            </div>
      </div>

      <div class="tabs tab-4">
            <div class="rows">
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-3.jpg?v=1678308061">
                        </div>
                  </div>
            </div>
            <div class="rows">
                  <div>
                        <div class="img-wrapper">
                              <img src="https://cdn.shopify.com/s/files/1/0668/0189/3661/files/placeholder-3-3.jpg?v=1678308061">
                        </div>
                  </div>
                  <div>
                        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod nobis, ipsum impedit voluptate ratione, unde itaque officiis tenetur repellendus dignissimos in voluptates! A, laborum quidem. Reiciendis maiores est nisi modi minus tenetur sapiente corrupti eos voluptatem explicabo inventore odio repudiandae excepturi nam, hic enim id, minima dicta harum. Quae harum, facere facilis aliquid molestiae labore veniam quos consequuntur inventore delectus iusto deserunt numquam libero quibusdam! Rerum odit hic alias commodi voluptates asperiores error reprehenderit facere atque dignissimos voluptatem, soluta magni eveniet iure laboriosam, qui nostrum nulla obcaecati inventore sint provident numquam incidunt tempore? Quod sunt dolorum distinctio, nemo eveniet consectetur.</p>
                  </div>
            </div>
      </div>

</div> 
              
            
!

CSS

              
                * {
    box-sizing: border-box;
    scroll-behavior: smooth;
}
body {
    padding: 40px;
    margin: 0;
}
#map-wrapper {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    column-gap: 40px;
    row-gap: 20px;
    padding: 30px;
    margin-bottom: 40px;
    border: 1px solid rgba(0,0,0, 0.5);
}
#map-wrapper div {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 300px;
    min-width: 200px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    cursor: pointer;
}
#map-wrapper div:nth-child(1) {
    background-color: grey;
}
#map-wrapper div:nth-child(2) {
    background-color: purple;
}
#map-wrapper div:nth-child(3) {
    background-color: green;
}
#map-wrapper div:nth-child(4) {
    background-color: turquoise;
}
#dropdown-wrapper {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: 51px;
    max-width: 300px;
    min-width: 200px;
    margin: 0;
    margin-bottom: 40px;
    z-index: 2;
    overflow: hidden;
}
#dropdown-wrapper.active {
    overflow: initial;
}
#dropdown-wrapper h2 {
    position: absolute;
    top: 0;
    left: 0;
    padding: 5px;
    font-size: 12px;
    font-weight: normal;
    margin: 0;
    z-index: 2;
}
.dropdown {
    position: relative;
    display: flex;
    padding: 0;
    flex-direction: column;
    width: 100%;
    height: auto;
    margin: 0;
    background-color: #fff;
    border: 1px solid rgba(0,0,0, 0.5);
    border-bottom: 0;
}
.options {
    order: 2;
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0, 0.5);
}
.options {
    text-align: center;
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    position: relative;
    cursor: pointer;
    list-style: none;
}
.tab-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    z-index: 1;
}
.tabs {
    left: 0;
    top: 0;
    width: 100%;
}
.tab-1 {
    background-color: grey;
}
.tab-2 {
    background-color: purple;
}
.tab-3 {
    background-color: green;
}
.tab-4 {
    background-color: turquoise;
}
.rows {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    display: flex;
    flex-direction: row;
    padding-bottom: 40px;
}
.rows>div {
    position: relative;
    box-sizing: border-box;
    width: 50%;
    height: auto;
    padding: 20px;
}
.rows .img-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
}
img {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    object-fit: cover;
    object-position: center;
}
p {
    font-size: 24px;
    margin: 0;
}

              
            
!

JS

              
                document.addEventListener("DOMContentLoaded", function(event) { 
window.requestAnimationFrame(function() {

console.clear();
let options = document.querySelectorAll(".options");
let tabs = document.querySelectorAll(".tabs");
let activeTab = 0;
let old = 0;
let animation;

for (let i = 0; i < options.length; i++) {
  options[i].index = i;
  gsap.set(tabs[i], {autoAlpha: 0, position: "absolute"}); 
  options[i].addEventListener("click", toogleTabs);
}

gsap.set(tabs[0], {autoAlpha: 1, position: "relative"});
gsap.set(options[0], {color:"blue"});

function toogleTabs() {
  if(this.index != activeTab) {
    if (animation && animation.isActive()) {animation.progress(1);}
    animation = gsap.timeline({defaults:{duration:0}});
    old = activeTab;
    activeTab = this.index;
    animation.to(options[old], {color:"#000",order: 2});
    animation.to(options[activeTab], {color:"blue",order: 1});
    animation.to(tabs[old], {autoAlpha: 0, position: "absolute", zIndex: 1,});
    animation.set(tabs[old], {autoAlpha: 0, position: "absolute"});
    animation.to(tabs[activeTab], {duration: 0, position: "relative", autoAlpha: 1, zIndex: 10});
  }
}

let dropdown = document.querySelectorAll("#dropdown-wrapper");
dropdown[0].addEventListener("click", dropdownToogle);
function dropdownToogle() {
  if(dropdown[0].classList.contains("active")) {dropdown[0].classList.remove("active");}
  else dropdown[0].classList.add("active");
}


});
});
              
            
!
999px

Console