Skip to content

Instantly share code, notes, and snippets.

@jung-han
Last active May 6, 2018 05:25
Show Gist options
  • Save jung-han/b3b14f976b021e7209a30388ce6e3302 to your computer and use it in GitHub Desktop.
Save jung-han/b3b14f976b021e7209a30388ce6e3302 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>tooltip testpage</title>
</head>
<body>
<p>The standard Lorem Ipsum passage, used since the 1500s</p>
<p>
"Lorem ipsum dolor sit amet, <strong id="first">consectetur</strong> adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
<strong class="second">nulla pariatur</strong>. Excepteur sint occaecat cupidatat non proident,
sunt in culpa qui officia deserunt mollit anim id est laborum."
</p>
<p><img src="https://i.ytimg.com/vi/RGvK_2MwRuM/maxresdefault.jpg" class="my-img" width="500"/></p>
<script src="./bundle.js"></script>
<script>
(function() {
// 툴팁 초기화
tooltip.init([
{
element: '#first',
contents: 'Duis aute irure dolor',
delay: 500
},
{
element: '.second',
contents: 'labore et dolore magna aliqua'
}
]);
// 툴팁 수정
tooltip.edit('#first', {
contents: 'Lorem ipsum',
delay: 0
});
// 툴팁 추가
tooltip.add('.my-img', {
contents: 'test image',
delay: 300
});
// 툴팁 제거
tooltip.remove('.second');
})();
</script>
</body>
</html>
'use strict';
var tooltip = require('./js/tooltip');
module.exports = tooltip;
'use strict';
var tooltip = {
init: function() {
return 'init';
},
add: function() {
return 'add';
},
edit: function() {
return 'edit';
},
remove: function() {
return 'remove';
}
};
module.exports = tooltip;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment