123

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.

            
              <div class="row">
  <div class="col l4 m8 s12 offset-m2 offset-l4">
    <div class="product-card">
        <div class="card  z-depth-4">
            <div class="card-image">
                <a href="#" class="btn-floating btn-large price waves-effect waves-light brown darken-3">5 €</a>
<!-- alternative image links:
http://i58.photobucket.com/albums/g249/Landry_Bete/dessert14_zpsg6u4skv6.jpg
https://www.dropbox.com/s/15xhr85exkhusgi/dessert14.jpg?raw=1 -->
                <img src="https://res.cloudinary.com/landry-bete/image/upload/v1488769144/dessert14_trnhnj.jpg" alt="product-img">
                <span class="card-title"><span>Macaron</span></span>
            </div>
            <ul class="card-action-buttons">
                <li><a href="https://www.facebook.com/sharer/sharer.php?u=https://codepen.io/lybete/full/jBMNzM/" target="_blank" class="btn-floating waves-effect waves-light white"><i class="material-icons grey-text text-darken-3">share</i></a>
                </li>
                <li><a class="btn-floating waves-effect waves-light red accent-2"><i class="material-icons like">favorite_border</i></a>
                </li>
                <li><a id="buy" class="btn-floating waves-effect waves-light blue"><i class="material-icons buy">add_shopping_cart</i></a>
                </li>
            </ul>
            <div class="card-content">
                <div class="row">
                    <div class="col s12">
                        <p>
                            <strong>Description:</strong> <br />
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare auctor metus vel mollis.
                        </p>
                    </div>
                    
                </div>
                <div class="row">
                        <div style="width: 95%; margin: auto;">
                            <div class="chip">Dessert</div>
                            <div class="chip">French</div>
                            <div class="chip">Sweet</div>
                            <div class="chip">Chocolate</div>
                            <div class="chip"><a href="#">More...</a></div>
                        </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</div>
            
          
!
            
              .card-title {
    font-weight: 300;
    font-size: 2rem;
}
.product-card .card {
    margin: 20px;
    overflow: hidden;
}
.product-card .card .card-content {
    padding: 5px;
}
.product-card .card .price {
    width: 70px;
    height: 70px;
    font-weight: 600;
    font-size: 1.45rem;
    line-height: 70px;
    margin: 10px;
    position: absolute;
    top: 0;
    letter-spacing: 0;
}
.product-card ul.card-action-buttons {
    margin: -18px 7px 0 0;
    text-align: right;
}
.product-card ul.card-action-buttons li {
    display: inline-block;
    padding-left: 7px;
}
.product {
    width: 20%;
    padding: 10px;
}
.product .card {
    margin: 0;
}
.product .card .card-content {
    padding: 5px 10px;
}

            
          
!
            
              jQuery(document).ready(function($) {
  
  //Buy button effects
  $('.buy').on('click', function() {
    
    //It is possible to put the 1st argument of setTimeout as callback of the Materialize.toast function but that approach seems significantly slower. I don't know why yet
    setTimeout (function() {
      $("#buy").removeClass("green");
      $('.buy').fadeOut(100, function() {
        $(this).text('add_shopping_cart').fadeIn(150);
      });
    }, 5000);
 
    
    $("#buy").addClass("green");
    $('.buy').fadeOut(100, function() {
      $(this).text('check').fadeIn(150);
    });
    
    var $toastContent = $('<div class="flow-text">ORDERED! &nbsp <a href="#" class=" amber-text">MY CART</a></div>');
    Materialize.toast($toastContent, 5000, "rounded");
    
   });
  
  //Like button effects
  
  $('.like').on('click', function() {
    
    setTimeout (function() {
      
      $('.like').fadeOut(100, function() {
        $(this).text('favorite_border').fadeIn(150);
      });
    }, 5000);
 
    $('.like').fadeOut(100, function() {
      $(this).text('favorite').fadeIn(150);
    });
    
    var $toastContent2 = $('<div class="flow-text">LIKED!</div>');
    Materialize.toast($toastContent2, 5000, "pink rounded");
    
   });
});


  
            
          
!
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.

Console