Pen Settings

HTML

CSS

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

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

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.

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

              
                <!-- Gray semi-transparent overlay
If you don't want the overlay, don't include this div.
If you do want it, include this div above all your content
-->
<div class="overlay"></div>


<!-- Shit you don't need -->
<div class="row">
  <div class="col s10 l6 offset-s1 offset-l3">
    <div class="card">
      <h3 align="center">FAB for Mobile</h3>
      <div class="container">
        <p>This forces tooltips to be shown on "mobile" and "tablet" sizes or small and medium according to Materialize</p>
        <blockquote>Try scaling your page below 993px to see overlay &amp; tooltips.</blockquote>
        <p>In order to use this there are a few things you need to add to your HTML.</p>
        <ol>
          <li>If you want the semi-transparent overlay you need to add a div with the .overlay class at the very top of your content and close it immediately after. Example in the code</li>
          <li>You will also need a trigger for the overlay so wrap your FAB div in a div with the class .overlay-trigger</li>
          <li>Each of your "fly out" buttons will need a &lt;span&gt; with the class .mobile-fab-tip after the &lt;li&gt; and before your &lt;a&gt;</li>
        </ol>
        <p>You can still use the normal hover state tooltips on desktop (and tablet if you wish, simply change the media queries and the javascript if statements)</p>
      </div>
    </div>
  </div>
</div>
<!-- End shit you don't need -->



<div class="overlay-trigger">
  <!-- If you don't want the overlay you don't need this -->

  <div class="fixed-action-btn" style="bottom: 45px; right: 24px;">
    <a class="btn-floating btn-large blue">
      <i class="large material-icons">add</i>
    </a>

    <ul>
      <li>
        <!-- add span with .mobile-fab-tip here after the <li> tag... -->
        <span class="mobile-fab-tip">Forward</span>
        <!-- ...and before the <a> tag -->
        <a href="#" class="btn-floating green tooltipped" data-position="left" data-tooltip="Forward">
          <i class="material-icons">forward</i>
        </a>
      </li>
      <li>
        <span class="mobile-fab-tip">Reply All</span>
        <a href="#" class="btn-floating yellow darken-1 tooltipped" data-position="left" data-tooltip="Reply All">
          <i class="material-icons">reply_all</i>
        </a>
      </li>
      <li>
        <span class="mobile-fab-tip">Reply</span>
        <a href="#" class="btn-floating red tooltipped" data-position="left" data-tooltip="Reply">
          <i class="material-icons">reply</i>
        </a>
      </li>
    </ul>
  </div>
</div>
              
            
!

CSS

              
                @media only screen and (max-width: 992px) {
  .overlay {
    display: none;
    background-color: #E1E1E1;
    opacity: 0.80;
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    z-index: 900;
  }
  .fixed-action-btn ul {
    display: none;
  }
  .fixed-action-btn:hover ul {
    display: block;
  }
  .material-tooltip {
    display: none !important;
  }
  .mobile-fab-tip {
    position: fixed;
    right: 85px;
    padding: 7px 5px 4px 5px;
    text-align: right;
    background-color: #323232;
    border-radius: 2px;
    color: #FFF;
    opacity: 0;
  }
  .mobile-fab-tip {
    -webkit-animation: fadein 1s;
    -moz-animation: fadein 1s;
    -o-animation: fadein 1s;
    animation: fadein 1s;
    -webkit-animation-fill-mode: forwards;
    -moz-animation-fill-mode: forwards;
    -o-animation-fill-mode: forwards;
    animation-fill-mode: forwards;
    -webkit-animation-delay: 0.5s;
    -moz-animation-delay: 0.5s;
    -o-animation-delay: 0.5s;
    animation-delay: 0.5s;
  }
  @keyframes fadein {
    0% { opacity: 0; }
    100% { opacity: 1; }
  }
  @-moz-keyframes fadein {
    /* Firefox */
    0% { opacity: 0; }
    100% { opacity: 1; }
  }
  @-webkit-keyframes fadein {
    /* Safari and Chrome */
    0% { opacity: 0; }
    100% { opacity: 1; }
  }
  @-o-keyframes fadein {
    /* Opera */
    0% { opacity: 0; }
    100% { opacity: 1; }
  }
}


/*** Desktop Only Styles ***/
@media only screen and (min-width: 993px) {
  .mobile-fab-tip {
    display: none;
  }
  .overlay {
    display: none;
  }
}
              
            
!

JS

              
                var width = 0;
$('.overlay-trigger').click(overlay);
$('.overlay').click(hideOverlay);
$(window).on("scroll", hideOverlay);

function overlay(event) {
  if (window.innerWidth < 992) {
    if ($('.overlay').css('display') == 'none') {
      $('.overlay').css({
        'display': 'block'
      });
      width = window.innerWidth;
    }
  }
}

function hideOverlay(event) {
  if (width < 992) {
    if ($('.overlay').css('display') == 'block') {
      $('.overlay').css({
        'display': 'none'
      });
    }
  }
}
              
            
!
999px

Console