]> source.dussan.org Git - jquery-ui.git/commitdiff
Tooltip demo: Use position option in tracking demo.
authorScott González <scott.gonzalez@gmail.com>
Sat, 8 Oct 2011 11:36:35 +0000 (07:36 -0400)
committerScott González <scott.gonzalez@gmail.com>
Sat, 8 Oct 2011 11:36:48 +0000 (07:36 -0400)
demos/tooltip/tracking.html

index 91494008682b54a7233dc122088691ab83dcea63..222330838f546b199dea3aa77125fdec3333b662 100644 (file)
        <script>
        $(function() {
                $( ".demo" ).tooltip({
+                       position: {
+                               my: "left+25 center",
+                               at: "center"
+                       },
                        open: function( event ) {
-                               var tooltip = $( ".ui-tooltip" );
+                               var tooltip = $( ".ui-tooltip" ),
+                                       positionOption = $( this ).tooltip( "option", "position" );
                                function position( event ) {
-                                       tooltip.position({
-                                               my: "left+25 center",
-                                               at: "right+25 center",
-                                               of: event
-                                       });
+                                       positionOption.of = event;
+                                       tooltip.position( positionOption );
                                }
                                $( document ).bind( "mousemove.tooltip-position", position );
                                // trigger once to override element-relative positioning