Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple events for show/hide?
15th November, 21:41
Post: #1
Multiple events for show/hide?
Just wondering if it's possible to have multiple events registered for show/hide behavior? I.E. if I have a control that I want context sensitive help displaying on mouseenter, I'd like to have the qtip hide on mouseleave AND on click (i.e. user clicks the button, it doesn't always hide the qtip).

Example: We had an ancient internal web app that used vba, javascript, and office web components that I have completely converted over to jquery with page methods/web services with the newer version of the pivot table control. Everything works great, except for a few buttons that are set for things such as resettting the pivot table view to a default. Clicking the button, the qtip still shows. I'd like to at least be able to set it to mouseleave and inactivity, but it seems that you can only specify one event?

Is there a way around this? Or am I missing some syntax somewhere?
Find all posts by this user
Quote this message in a reply
16th November, 18:18 (This post was last modified: 16th November 18:19 by garbledygook.)
Post: #2
[Workaround]: Multiple events for show/hide?
(15th November 21:41)garbledygook Wrote:  Just wondering if it's possible to have multiple events registered for show/hide behavior? I.E. if I have a control that I want context sensitive help displaying on mouseenter, I'd like to have the qtip hide on mouseleave AND on click (i.e. user clicks the button, it doesn't always hide the qtip).

Example: We had an ancient internal web app that used vba, javascript, and office web components that I have completely converted over to jquery with page methods/web services with the newer version of the pivot table control. Everything works great, except for a few buttons that are set for things such as resettting the pivot table view to a default. Clicking the button, the qtip still shows. I'd like to at least be able to set it to mouseleave and inactivity, but it seems that you can only specify one event?

Is there a way around this? Or am I missing some syntax somewhere?

Workaround (note: may not be the safest or best way to do it, but it's working):
Place an event binding in the javascript for the control(s) in question for the type of event that you want to trigger the show/hide for the qtip. In my case, it is more about hiding it when I need it for multiple types of events (say for pop-up help on a button).

JS Code
$('#myLinkButton').click(function() { $(this).qtip('hide'); }); // Could use multiple function syntax as well...

You could even do this inside of an each loop based on class or selector:
JS Code
$('.ui-icon-help').each(function(i) {
     var sContent = '';
     var sTargetCorner = '';
     var sTooltipCorner = '';
     var sShow = 'mouseenter';
     var sHide = 'mouseleave';
 
     switch ($(this).attr('id')) { // just an example, no need to nitpick
          case 'help-system':
                   // do something here for content, etc 
          case 'help-report':
                  // do something here for content, etc != above
     }
 
     addQtip($(this), sContent, sTargetCorner, sTooltipCorner, show, hide); // I created a function to call to add it     
});
Find all posts by this user
Quote this message in a reply
16th November, 19:38
Post: #3
RE: Multiple events for show/hide?
This is possible by default in 2.0 by specifying multiple space separated events. In 1.0 however you can do it using the onRender callback:

JS Code
$('.selector').qtip({
   show: 'mouseover',
   api: {
      onRender: function() {
         this.elements.target.bind('click', this.show);
      }
   }
});

Craig Thompson
Web Developer / Designer
Craigsworks
http://www.craigsworks.com
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  show fixed on the first time cyberziz 2 1,255 11th March 08:29
Last Post: cyberziz
  Slide Effect on Show Hide ahofferth 1 1,344 11th July 15:56
Last Post: Craig
  [Solved] Applying different content to multiple qTips in one call Craig 5 4,038 19th February 01:53
Last Post: teeks
  Avoid to hide while hover the tip palaueb 4 1,993 9th December 15:01
Last Post: ralphholzmann
  How to show the tooltip programmatically? overthetop 2 2,212 30th November 10:29
Last Post: overthetop
  show/hide "advanced" options wcmanes 14 6,338 20th October 00:37
Last Post: Craig



User(s) browsing this thread: 1 Guest(s)