Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use the events onShow and onHide on each of your tooltips and do modifications to the trigger object. I'll show this to you with your code. Here are your trigger button divs:</p> <pre><code>&lt;div id="eleven_div" class="button-eleven" style="display: block; "&gt; &lt;a href="projects/gantt/" id="button"&gt;Button 11&lt;/a&gt; &lt;/div&gt; &lt;div id="ten_div" class="button-ten" style="display: block; "&gt; &lt;a href="projects/table/" id="button"&gt;Button 10&lt;/a&gt; &lt;/div&gt; ... </code></pre> <p>And the corresponding javascript:</p> <pre><code>$(".button-one").tooltip({ position: "center right", delay:300, effect: 'slide', direction:'right', offset: [30, -12], slideOffset: 30, slideFade:'true', slideInSpeed:350, slideOutSpeed:250 }); $(".button-two").tooltip({ position: "bottom left", delay:300, effect: 'slide', direction:'left', offset: [-34, 20], slideOffset: 30, slideFade:'true', slideInSpeed:350, slideOutSpeed:250 }); ... </code></pre> <p>First you have the attribute id="button" inside each of your a-tags inside the divs. It is absolutly wrong. Ids must not occur twice. So better change this into classes:</p> <pre><code>&lt;div id="eleven_div" class="button-eleven" style="display: block; "&gt; &lt;a href="projects/gantt/" class="button"&gt;Button 11&lt;/a&gt; &lt;/div&gt; &lt;div id="ten_div" class="button-ten" style="display: block; "&gt; &lt;a href="projects/table/" class="button"&gt;Button 10&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Now place the callback function for the red dots to be shown. The function is called every time a tooltip is shown or will be hide again. And it adds or removes a class to the a-tag inside the triggering div. New code:</p> <pre><code>function hovering() { this.getTrigger().find("a").first().toggleClass("hovered"); } $(document).ready(function() { $(".button-one").tooltip({ position: "center right", delay:300, effect: 'slide', direction:'right', offset: [30, -12], slideOffset: 30, slideFade:'true', slideInSpeed:350, slideOutSpeed:250, onShow: hovering, onHide: hovering }); $(".button-two").tooltip({ position: "bottom left", delay:300, effect: 'slide', direction:'left', offset: [-34, 20], slideOffset: 30, slideFade:'true', slideInSpeed:350, slideOutSpeed:250, onShow: hovering, onHide: hovering }); ... </code></pre> <p>At last change your CSS code, where the styles for #button are located into this:</p> <pre><code>.button { background:transparent url(../images/red-circle.png) no-repeat scroll 0px -2px; display:block; height:23px; width:23px; overflow:hidden; text-indent:-999em; cursor:pointer; opacity: 1; -webkit-transition: opacity 1s; -moz-transition: opacity 1s; -o-transition: opacity 1s; } /** * mouseover state, * elements with the "hovered" class now behave * like ones in mouseover state */ .button:hover, .button.hovered{ background-position:0 -25px; opacity: 1; } /* clicked state */ .button:focus { background-position:0 -25px; } </code></pre> <hr> <p>To have the tooltip getting closed when a link is clicked, put this code after your tooltip definitions:</p> <pre><code>$(".tooltip, .tooltip-brite, ... all your tooltip-classes").live("click", function() { $(this).prev().tooltip().hide(); }); $(".button-two, .button-one, ... all your button-classes").live("click", function() { $(this).tooltip().hide(); }); </code></pre> <p>This will close the tooltip when ether the div with the red dot indside or the tooltip box is clicked.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload