css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <h1>Highest Mountains in the World</h1>
<h3>Click '+' for the effect</h3>
<h4>Change the window size for responsive layout</h4>
<div class="grid_items">
  <div class="grid_item tab active">
    <img src="https://www.dropbox.com/s/aom5gac4h7scf5q/everest.jpg?raw=1" alt="Mount Everest"></img>
    <div class="title">Mount Everest
      <button><span>more info</span></button>
    </div>
    <div class="content">
      <p>Mount Everest, known in Nepali as Sagarmāthā and in Tibetan as Chomolungma, is Earth's highest mountain above sea level, located in the Mahalangur Himal sub-range of the Himalayas. The international border between China (Tibet Autonomous Region) and Nepal (Province No. 1) runs across its summit point.</p>
      <p>The current official elevation of 8,848 m (29,029 ft), recognised by China and Nepal, was established by a 1955 Indian survey and subsequently confirmed by a Chinese survey in 1975.[1] In 2005, China remeasured the rock height of the mountain, with a result of 8844.43 m.</p>
    </div>
  </div>
  <div class="grid_item tab">
    <img src="https://www.dropbox.com/s/flfd8e7o17h2rbw/k2.jpg?raw=1" alt="K2"></img>
    <div class="title">K2
      <button><span>more info</span></button>
    </div>
    <div class="content">
      <p>K2 is known as the Savage Mountain due to the extreme difficulty of ascent. It has the second-highest fatality rate among the eight thousanders. With around 300 successful summits and 77 fatalities, about one person dies on the mountain for every four who reach the summit.</p>
      <p>It is more difficult and hazardous to reach the peak of K2 from the Chinese side, so it is usually climbed from the Pakistani side. Unlike Annapurna, the mountain with the highest fatality-to-summit rate (191 summits and 61 fatalities), or the other eight thousanders, K2 has never been climbed during winter.</p>
    </div>
  </div>
  <div class="grid_item tab">
    <img src="https://www.dropbox.com/s/jihrvz3ruqtodh6/Kangchenjunga.jpg?raw=1" alt="Kangchenjunga"></img>
    <div class="title">Kangchenjunga
      <button><span>more info</span></button>
    </div>
    <div class="content">
      <p>Mount Kangchenjunga lies about 125 km (78 mi) east-south-east of Mount Everest. It is the second highest mountain of the Himalayas. Three of the five peaks – Main, Central and South – are on the border between North Sikkim and Nepal. Two peaks are in Nepal's Taplejung District.</p>
      <p>Kangchenjunga Main is the highest mountain in India, and the easternmost of the mountains higher than 8,000 m (26,000 ft). It is called Five Treasures of Snow after its five high peaks, and has always been worshipped by the people of Darjeeling and Sikkim.</p>
    </div>
  </div>
</div>
            
          
!
            
              body {
  font-family: "Montserrat", sans-serif;
  line-height: 1.375em;
}
h1 {
  text-align: center;
  color: Teal;
  padding-top: 2.5%;
  line-height: 1.25em;
}
h3, h4 {
  text-align: center;
  color:grey; 
  line-height: 1.25em;
}
div {
  box-sizing: border-box;
}
.grid_items {
  margin: 7.5% 5%;
  color: #ffffff;
  background-color: Teal;
}
.grid_item {
  position: relative;
}
.grid_item img {
  width: 100%;
}
.grid_item > div {
  padding: 20px 30px;
}
.grid_item > .title {
  position: absolute;
  top: 0;
  padding-top: 52.5%;
  width: 100%;
  font-size: 1.5em;
  font-weight: bold;
}
.grid_item button {
  display: none;
  cursor: pointer;
}

@media only screen and (min-width: 786px) {
  .grid_items {
    display: grid;
    grid-template-columns: 33.333333% 33.333333% 33.333333%;
    grid-column-gap: 0;
  }
  .grid_item button {
    display: block;
    float: right;
    width: 36px;
    height: 36px;
    margin-top: -6px;
    background-color: #ffffff;
    border: none;
  }
  .grid_item button > span {
    display: none;
  }
  .grid_item button::before {
    content: "+";
    font-size: 3em;
    line-height: 0.625em;
    color: Teal;
  }
  .grid_item.active button::before {
    content: "-";
  }
  .grid_item > .content {
    transform: translatex(-2000px);
    opacity: 0;
    width: 300%;
    transition: transform 0.3s ease-in-out 0s, opacity 0.3s ease-in-out 0.3s;
  }
  .grid_item:nth-child(3n + 2) > .content {
    margin-left: -100%;
  }
  .grid_item:nth-child(3n) > .content {
    margin-left: -200%;
  }
  .grid_item.active {
    z-index: 1;
  }
  .grid_item.active > .content {
    transform: translatey(0);
    opacity: 1;
  }
  .grid_item img {
    opacity: 0.5;
    transition: all 0.3s ease-in-out;
  }
  .grid_item.active img {
    opacity: 1;
    transform: translatey(-20%);
  }
  .grid_item > .title {
    font-size:1.125em;
    transition: margin 0.3s ease-in-out;
  }
  .grid_item.active > .title {
    margin-top: 10%;
  }
}
@media only screen and (min-width: 981px) {
  .grid_item > .title {
    font-size:1.5em;
  }
}
            
          
!
            
              //click
$("button").click(function() {
  $(this)
    .parents(".grid_item")
    .toggleClass("active");
  $(this)
    .parents(".grid_item")
    .siblings(".grid_item")
    .removeClass("active");
});

            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console