This repository was archived by the owner on Nov 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
add class scope, re-init before showing, rich triangle #6
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e362baf
add class scope, re-init before showing, rich triangle
KynoYang 65276ab
clear code
KynoYang f2e9a48
let title inherit from title attribute when tooltipTitle is undifined
KynoYang 9eff967
remove and set 'after' color transparent
KynoYang 0fe47c9
add tooltipLazy to scope
KynoYang a8020df
boolean value should be evaluated
KynoYang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,20 +26,25 @@ | |
| , width | ||
| , offsetTop | ||
| , offsetLeft | ||
| , title = attr.title || '' | ||
| , title = attr.tooltipTitle || attr.title || '' | ||
| , content = attr.tooltipContent || '' | ||
| , showTriggers = attr.tooltipShowTrigger || 'mouseenter mouseover' | ||
| , hideTriggers = attr.tooltipHideTrigger || 'mouseleave mouseout' | ||
| , side = attr.tooltipSide || 'top' | ||
| , size = attr.tooltipSize || 'medium' | ||
| , tryPosition = attr.tooltipTry || 1 // If set into 0 , the auto-position method will not call | ||
| , className = attr.tooltipClass || '' | ||
| , lazyMode = $scope.$eval(attr.tooltipLazy || true) | ||
| , htmlTemplate = '<div class="_720kb-tooltip _720kb-tooltip-' + side + ' _720kb-tooltip-' + size + '">' + | ||
| '<div class="_720kb-tooltip-title"> ' + title + '</div>' + | ||
| content + ' <span class="_720kb-tooltip-caret"></span>' + | ||
| '</div>'; | ||
|
|
||
| //create the tooltip | ||
| theTooltip = $compile(htmlTemplate)($scope); | ||
|
|
||
| theTooltip.addClass(className); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would put a line break between line 43 and 44 ;) |
||
|
|
||
| body.append(theTooltip); | ||
|
|
||
| $scope.initTooltip = function getInfos (tooltipSide) { | ||
|
|
@@ -77,7 +82,7 @@ | |
|
|
||
| thisElement.bind(showTriggers, function onMouseEnterAndMouseOver() { | ||
|
|
||
| if (!initialized) { | ||
| if (!lazyMode || !initialized) { | ||
|
|
||
| initialized = true; | ||
| $scope.initTooltip(side); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something wrong with the caret style, i see tooltip content in lighter background color and caret is darker( caret is more black , content is more grey)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's my fault.

I add this because in our design, I need to set a border for the whole tooltip including the triangle. So, I use two triangle: the "before" one with larger size works as the border, the "after" one with smaller size works as the content. Just like what github does. You can check the style of github.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok no problems just give to caret and content the same background ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are the same. The color of triangle is darker because of opacity.
How about set “after” no color? it makes the triangle look like what it is before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes as it was before i think it was ok.
I liked a lot the "trasparent" replacement of rgba(0,0,0,0) you did, are we sure is it supported as well and even better than rgba()?
I tried searching a lot but no results, probably trasparent is fully supported since CSS1 so better than rgba() in such cases....