Skip to content

Commit 06fd815

Browse files
author
Jason Frame
committed
Tidy up CSS styles to aid custom arrow styling
1 parent 8cbf19d commit 06fd815

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

docs/src/tipsy-docs.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33
#gravity a { }
44
#gravity a:hover { color: #505050; background: none; }
55

6-
.red .tipsy-inner { background: red; }
6+
.red .tipsy-inner { background: red; }
7+
.red .tipsy-arrow-n { border-bottom-color: red; }
8+
.red .tipsy-arrow-s { border-top-color: red; }
9+
.red .tipsy-arrow-e { border-left-color: red; }
10+
.red .tipsy-arrow-w { border-right-color: red; }

src/javascripts/jquery.tipsy.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
}
6161

6262
$tip.css(tp).addClass('tipsy-' + gravity);
63+
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
6364
if (this.options.className) {
6465
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
6566
}

src/stylesheets/tipsy.css

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
/* Uncomment for shadow */
88
/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
99

10-
.tipsy-arrow { position: absolute; width: 0; height: 0; }
10+
.tipsy-arrow { position: absolute; width: 0; height: 0; border: 5px solid transparent; }
1111

12-
.tipsy-n .tipsy-arrow, .tipsy-nw .tipsy-arrow, .tipsy-ne .tipsy-arrow { top: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid black; }
13-
.tipsy-s .tipsy-arrow, .tipsy-sw .tipsy-arrow, .tipsy-se .tipsy-arrow { bottom: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid black; }
12+
/* Rules to colour arrows */
13+
.tipsy-arrow-n { border-bottom-color: #000; }
14+
.tipsy-arrow-s { border-top-color: #000; }
15+
.tipsy-arrow-e { border-left-color: #000; }
16+
.tipsy-arrow-w { border-right-color: #000; }
17+
18+
.tipsy-n .tipsy-arrow, .tipsy-nw .tipsy-arrow, .tipsy-ne .tipsy-arrow { top: 0; border-top: none; }
19+
.tipsy-s .tipsy-arrow, .tipsy-sw .tipsy-arrow, .tipsy-se .tipsy-arrow { bottom: 0; border-bottom: none; }
1420
.tipsy-n .tipsy-arrow, .tipsy-s .tipsy-arrow { left: 50%; margin-left: -5px; }
1521
.tipsy-nw .tipsy-arrow, .tipsy-sw .tipsy-arrow { left: 10px; }
1622
.tipsy-ne .tipsy-arrow, .tipsy-se .tipsy-arrow { right: 10px; }
1723
.tipsy-e .tipsy-arrow, .tipsy-w .tipsy-arrow { top: 50%; margin-top: -5px; }
18-
.tipsy-e .tipsy-arrow { right: 0; border-top: 5px solid transparent; border-left: 5px solid black; border-bottom: 5px solid transparent; }
19-
.tipsy-w .tipsy-arrow { left: 0; border-top: 5px solid transparent; border-right: 5px solid black; border-bottom: 5px solid transparent; }
24+
.tipsy-e .tipsy-arrow { right: 0; border-right: none; }
25+
.tipsy-w .tipsy-arrow { left: 0; border-left: none; }

0 commit comments

Comments
 (0)