Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add classPrefix to options #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion dist/css/tooltip-theme-arrows.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@
top: 50%;
margin-top: -8px;
border-right-color: #000; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-left.tooltip-target-attached-center .tooltip-content {
left: -16px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-right.tooltip-target-attached-center .tooltip-content {
left: 16px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content {
margin-top: 8px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before {
bottom: 100%;
left: 8px;
border-bottom-color: #000; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content {
margin-top: 8px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before {
bottom: 100%;
right: 8px;
border-bottom-color: #000; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content {
margin-bottom: 8px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before {
top: 100%;
left: 8px;
border-top-color: #000; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content {
margin-bottom: 8px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before {
top: 100%;
right: 8px;
border-top-color: #000; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content {
margin-top: 8px; }
.tooltip-element.tooltip-theme-arrows.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content:before {
Expand Down Expand Up @@ -108,4 +136,4 @@
.tooltip-element.tooltip-theme-arrows {
pointer-events: none; }
.tooltip-element.tooltip-theme-arrows .tooltip-content {
padding: 0.5em 1em; }
padding: .5em 1em; }
30 changes: 29 additions & 1 deletion dist/css/tooltip-theme-twipsy.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,34 @@
top: 50%;
margin-top: -10px;
border-right-color: #414141; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-left.tooltip-target-attached-center .tooltip-content {
left: -20px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-right.tooltip-target-attached-center .tooltip-content {
left: 20px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content {
margin-top: 10px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before {
bottom: 100%;
left: 10px;
border-bottom-color: #414141; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content {
margin-top: 10px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before {
bottom: 100%;
right: 10px;
border-bottom-color: #414141; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content {
margin-bottom: 10px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-left.tooltip-target-attached-middle .tooltip-content:before {
top: 100%;
left: 10px;
border-top-color: #414141; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content {
margin-bottom: 10px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-bottom.tooltip-element-attached-right.tooltip-target-attached-middle .tooltip-content:before {
top: 100%;
right: 10px;
border-top-color: #414141; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content {
margin-top: 10px; }
.tooltip-element.tooltip-theme-twipsy.tooltip-element-attached-top.tooltip-element-attached-left.tooltip-target-attached-bottom .tooltip-content:before {
Expand Down Expand Up @@ -111,7 +139,7 @@
transition: opacity 150ms;
pointer-events: none; }
.tooltip-element.tooltip-theme-twipsy .tooltip-content {
padding: 0.5em 1em; }
padding: .5em 1em; }
.tooltip-element.tooltip-theme-twipsy .tooltip-content {
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
border-radius: 2px;
Expand Down
10 changes: 5 additions & 5 deletions dist/js/tooltip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! tether-tooltip 1.1.0 */
/*! tether-tooltip 1.2.0 */

(function(root, factory) {
if (typeof define === 'function' && define.amd) {
Expand All @@ -20,10 +20,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons

var extend = Tether.Utils.extend;

var _Drop = Drop.createContext({
classPrefix: 'tooltip'
});

var defaults = {
position: 'top center',
openOn: 'hover',
Expand All @@ -40,6 +36,10 @@ var Tooltip = (function () {

this.options = options;

var _Drop = Drop.createContext({
classPrefix: this.options.classPrefix || 'tooltip'
});

if (!this.options.target) {
throw new Error('Tooltip Error: You must provide a target for Tooltip to attach to');
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tooltip.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/js/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

const { extend } = Tether.Utils;

const _Drop = Drop.createContext({
classPrefix: 'tooltip'
});

const defaults = {
position: 'top center',
openOn: 'hover',
Expand All @@ -20,6 +16,10 @@ class Tooltip {
constructor(options) {
this.options = options;

const _Drop = Drop.createContext({
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only real change here.

classPrefix: this.options.classPrefix || 'tooltip'
});

if (!this.options.target) {
throw new Error('Tooltip Error: You must provide a target for Tooltip to attach to');
}
Expand Down