Skip to content

Commit 8deb745

Browse files
committed
Merge branch 'master' into widget-factory-demo
2 parents afe0f72 + 2a27499 commit 8deb745

File tree

9 files changed

+319
-43
lines changed

9 files changed

+319
-43
lines changed

demos/tooltip/custom-animation.html

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@
2626
delay: 250
2727
}
2828
});
29-
$( "#position-option" ).tooltip({
29+
$( "#open-event" ).tooltip({
30+
show: null,
3031
position: {
3132
my: "left top",
32-
at: "left bottom+10",
33-
using: function( pos ) {
34-
$( this ).css({
35-
left: pos.left,
36-
top: pos.top - 10
37-
}).animate({ top: pos.top }, "fast" );
38-
}
33+
at: "left bottom"
34+
},
35+
open: function( event, ui ) {
36+
ui.tooltip.animate({ top: ui.tooltip.position().top + 10 }, "fast" );
3937
}
4038
});
4139
});
@@ -48,16 +46,15 @@
4846
<p>There are various ways to customize the animation of a tooltip.</p>
4947
<p>You can use the <a id="show-option" href="http://jqueryui.com/demos/tooltip/#option-show" title="slide down on show">show</a> and
5048
<a id="hide-option" href="http://jqueryui.com/demos/tooltip/#option-hide" title="explode on hide">hide</a> options.</p>
51-
<p>You can also use the <a id="position-option" href="http://jqueryui.com/demos/tooltip/#option-position" title="move down on show">position option</a>.</p>
49+
<p>You can also use the <a id="open-event" href="http://jqueryui.com/demos/tooltip/#event-open" title="move down on show">open event</a>.</p>
5250

5351
</div><!-- End demo -->
5452

5553

5654

5755
<div class="demo-description">
58-
<p>This demo shows how to customize animations. The tooltip is shown, after a
59-
delay of 250ms, using a slide down animation, and hidden, after another delay,
60-
without an animation.</p>
56+
<p>This demo shows how to customize animations using the show and hide options,
57+
as well as the open event.</p>
6158
</div><!-- End demo-description -->
6259

6360
</body>

demos/tooltip/delegation-mixbag.html renamed to demos/tooltip/custom-content.html

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
<title>jQuery UI Tooltip - Default demo</title>
5+
<title>jQuery UI Tooltip - Custom content</title>
66
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
77
<script src="../../jquery-1.5.1.js"></script>
88
<script src="../../ui/jquery.ui.core.js"></script>
@@ -18,6 +18,10 @@
1818
.photo .ui-widget-header {
1919
margin: 1em 0;
2020
}
21+
.map {
22+
width: 350px;
23+
height: 350px;
24+
}
2125
</style>
2226
<script>
2327
$(function() {
@@ -26,16 +30,9 @@
2630
content: function() {
2731
var element = $( this );
2832
if ( element.is( "[data-geo]" ) ) {
29-
return $( "<iframe>", {
30-
width: 425,
31-
height: 350,
32-
frameborder: 0,
33-
scrolling: "no",
34-
marginheight: 0,
35-
marginwidth: 0,
36-
src: "http://maps.google.com/maps?ll=" + element.attr( "data-geo" ) +
37-
"&z=11&t=p&output=embed"
38-
});
33+
return "<img class='map' src='http://maps.google.com/maps/api/staticmap?" +
34+
"zoom=11&size=350x350&maptype=terrain&sensor=false&center=" +
35+
element.text() + "'>";
3936
}
4037
if ( element.is( "[title]" ) ) {
4138
return element.attr( "title" );
@@ -55,7 +52,7 @@
5552
<div class="ui-widget photo">
5653
<div class="ui-widget-header ui-corner-all">
5754
<h2>St. Stephen's Cathedral</h2>
58-
<h3><a href="http://maps.google.com/maps?q=vienna,+austria&z=11" data-geo="48.208174,16.373819">Vienna, Austria</a></h3>
55+
<h3><a href="http://maps.google.com/maps?q=vienna,+austria&z=11" data-geo>Vienna, Austria</a></h3>
5956
</div>
6057
<a href="http://en.wikipedia.org/wiki/File:Wien_Stefansdom_DSC02656.JPG">
6158
<img src="images/st-stephens.jpg" alt="St. Stephen's Cathedral" class="ui-corner-all">
@@ -65,7 +62,7 @@ <h3><a href="http://maps.google.com/maps?q=vienna,+austria&z=11" data-geo="48.20
6562
<div class="ui-widget photo">
6663
<div class="ui-widget-header ui-corner-all">
6764
<h2>Tower Bridge</h2>
68-
<h3><a href="http://maps.google.com/maps?q=london,+england&z=11" data-geo="51.500152,-0.126236">London, England</a></h3>
65+
<h3><a href="http://maps.google.com/maps?q=london,+england&z=11" data-geo>London, England</a></h3>
6966
</div>
7067
<a href="http://en.wikipedia.org/wiki/File:Tower_bridge_London_Twilight_-_November_2006.jpg">
7168
<img src="images/tower-bridge.jpg" alt="Tower Bridge" class="ui-corner-all">

demos/tooltip/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ <h4>Examples</h4>
1414
<li><a href="forms.html">Forms with tooltips</a></li>
1515
<li><a href="tracking.html">Track the mouse</a></li>
1616
<li><a href="custom-animation.html">Custom animation</a></li>
17-
<li><a href="delegation-mixbag.html">Delegation Mixbag</a></li>
17+
<li><a href="custom-content.html">Custom content</a></li>
1818
<li><a href="video-player.html">Video Player</a></li>
1919
</ul>
2020
</div>

tests/unit/tooltip/tooltip_defaults.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ commonWidgetTests( "tooltip", {
22
defaults: {
33
content: function() {},
44
disabled: false,
5+
hide: true,
56
items: "[title]",
67
position: {
78
my: "left+15 center",
89
at: "right center",
910
collision: "flip fit"
1011
},
12+
show: true,
1113
tooltipClass: null,
1214

1315
// callbacks
14-
create: null
16+
close: null,
17+
create: null,
18+
open: null
1519
}
1620
});

tests/unit/tooltip/tooltip_events.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,21 @@
33
module( "tooltip: events" );
44

55
test( "programmatic triggers", function() {
6-
expect( 2 );
7-
var element = $( "#tooltipped1" ).tooltip();
6+
expect( 4 );
7+
var tooltip,
8+
element = $( "#tooltipped1" ).tooltip();
89

9-
element.one( "tooltipopen", function( event ) {
10+
element.one( "tooltipopen", function( event, ui ) {
11+
tooltip = ui.tooltip;
1012
ok( !( "originalEvent" in event ), "open" );
13+
strictEqual( ui.tooltip[0],
14+
$( "#" + element.attr( "aria-describedby" ) )[0], "ui.tooltip" );
1115
});
1216
element.tooltip( "open" );
1317

14-
element.one( "tooltipclose", function( event ) {
18+
element.one( "tooltipclose", function( event, ui ) {
1519
ok( !( "originalEvent" in event ), "close" );
20+
strictEqual( ui.tooltip[0], tooltip[0], "ui.tooltip" );
1621
});
1722
element.tooltip( "close" );
1823
});

tests/unit/widget/widget.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
<script src="widget_core.js"></script>
1717
<script src="widget_extend.js"></script>
18+
<script src="widget_animation.js"></script>
1819

1920
<script src="../swarminject.js"></script>
2021
</head>

0 commit comments

Comments
 (0)