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

              
                <header>
  <div class="wrap">
    <h1>This is a tooltiper. It works with <span class="tooltiper"data-tooltip="Just wrap your element in any html element with tooltiper class and add your content inside a data-tooltip attribute">data attribute</span></h1>
  </div>
</header>

<section class="content">
  <div class="wrap"><p><span class="tooltiper" data-tooltip="Siri, Google Now, Alexa, and Slackbots">Machine learning</span> techniques have progressed to the point where a new user interface is on the cusp of mass-market adoption: computer systems that understand enough natural human language to be useful and respond accordingly.  Siri, Google Now, Alexa, and <span class="tooltiper" data-tooltip="Bla bla blabla bla bla bla">Slackbots</span> are a few high-profile examples of voice or message-driven experiences that have gained some level of real-world use. Indeed, these and other AI systems are now open enough, and of high-enough quality, <span class="tooltiper" data-tooltip="Siri, Google Now, Alexa, and Slackbots">to</span> allow brands to begin interacting with customers and prospects through natural language. The result is the beginning of a new era in customer relationships that promises to be every bit transformative as social media and mobile devices were in the last decade.
    </p><p>In light of this, companies need to ask themselves one question: can your customers talk to your brand?
    </p><h4>An Inflection Point for Natural Language.
    </h4><p>Technology periodically forces a radical reshuffling of the mechanism in which brands build relationships with consumers.  Mass marketing was born in the industrial revolution as supply outstripped demand for the first time, necessitating print advertising. Radio, television, and then cable TV were the next sequential developments, each allowing progressively broader, more targeted, and more impactful communications.
    </p><p>The Internet revolution has brought us a radical change in people-to-brand communications roughly once each decade. First, the very idea of a website was novel, and 1995 saw a shift from call center and direct mail to web. The mid-aughts brought us the mobile and social revolution, where no brand communication strategy was complete without vibrant social media channels, mobile apps, and mobile web presence—indeed, today it is rare that a company is not mobile-first in its communications strategy.
    </p><p>Customer-service solutions have toyed with automated phone and email responses-- to much consumer frustration--for a generation, but the mid-teens mark an inflection point in machine learning as it relates to natural language. Finally, computer systems can translate the unstructured data of human speech and reliably convert it into structured data. This structured data can then be processed like any other data input by a user, allowing the computer to perform actions and generate a natural language response. The result: real-world applications of natural language interfaces are ready for prime time. These natural language—or conversational—interfaces can be by voice or text, accessible by speaking into a microphone or typing into a text box.
    </p><p>More excitingly, the leading conversational interface platforms are, allowing third-party development of “conversational apps.”  Alexa, Siri, Google Now, iMessage, and Slack are a few of the long list of conversational interface platforms that do, or will soon, allow the development of third-party applications. And, artificial intelligence platforms such as api.ai and Microsoft Cognitive Services simplify the development of conversational apps, standardizing natural language processing and simplifying access to conversational platforms.
    </p></div>
</section>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Montserrat:400,700');

* {
  margin:0;
  padding:0;
  outline:none;
  list-style:none;
  text-decoration:none;
  box-sizing:border-box;
  color:#111;
  background: transparent;
  border:none;
}

body {
  background: #f3f3f3;
  font-family: 'Montserrat', sans-serif;
}

h1, h2, h3 {
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.wrap {
  width: 90%;
  max-width: 1024px;
  margin: 0 auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
  -moz-transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
}

header {
  height: 450px;
  background: #fff;
  text-align: center;
}

header h1 {
  font-size: 72px;
}

.content .wrap {
  padding-right: 300px;
  top: 100px;
  transform: none;
  -moz-transform: none;
  -webkit-transform: none;
}

.content .wrap p {
  margin-bottom: 30px;
  line-height: 1.8em;
}

.tooltiper {
  position: relative;
  display: inline-block;
  color: rgba(126, 0, 255,0.9);
}

/* tooltiper css */

.tooltiper {
  position: relative;
  z-index: 3;
}

.tooltiper .tooltip {
  position: absolute;
  font-size: 0.7rem;
  text-align: left;
  background: rgba(126, 0, 255,0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 5px;
  display: block;
  top: -30px;
  left: 50%;
  height: 0;
  transform: translateX(-50%) translateY(50%);
  -webkit-transform: translateX(-50%) translateY(50%);
  -o-transform: translateX(-50%) translateY(50%);
  line-height: 1.4em;
  opacity: 0;
  transform-origin: top;
  transition: transform 0.2s ease-out, opacity 0.1s ease-out 0.1s;
  -webkit-transition: transform 0.2s ease-out, opacity 0.1s ease-out 0.1s;
  -o-transition: transform 0.2s ease-out, opacity 0.1s ease-out 0.1s;
}

.tooltiper:hover .tooltip {
  opacity: 1;
  height: auto;
  transform: translateX(-50%) translateY(0);
  -webkit-transform: translateX(-50%) translateY(0);
  -o-transform: translateX(-50%) translateY(0);
  transition: transform 0.2s ease-out, opacity 0.1s ease-out;
  -webkit-transition: transform 0.2s ease-out, opacity 0.1s ease-out;
  -o-transition: transform 0.2s ease-out, opacity 0.1s ease-out;
}

.tooltiper .tooltip:after {
  left: calc(50% - 4px);
  top: calc(100% + 4px);
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
}

.tooltiper .tooltip:after {
  border-color: transparent;
  border-top-color: rgba(126, 0, 255,0.9);
  border-width: 4px;
  margin-top: -4px;
}
              
            
!

JS

              
                var elements = '';

$(document).ready(function(){
  toolTiper('.tooltiper');
});
var eLtop = '';
var eLleft = '';
var eLtw = '';
var eLth = '';
var eLcontent= '';

function toolTiper(elements) {
  $(elements).each(function(){
      var eLcontent = $(this).attr('data-tooltip');
      var eLtop = $(this).position().top;
      var eLleft = $(this).position().left;
    $(this).append('<span class="tooltip">'+eLcontent+'</span>');
    var eLtw = $(this).find('.tooltip').width(),
        eLth = $(this).find('.tooltip').height();
    console.log(eLtw);
    $(this).find('.tooltip').css({
      "top": (0 - eLth)+'px'
    });
  });
}
              
            
!
999px

Console