Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] [Solved] Troubles with hiding Qtip on click+unfocus
5th February, 02:57
Post: #1
[Solved] [Solved] Troubles with hiding Qtip on click+unfocus
I'm not sure if this a bug or maybe I'm doing something wrong (My JS skills are weak) but the problem I'm experiencing is that I'd like to have images which when clicked show the Qtip and when the user clicks the image or any area of the browser window the Qtip becomes hidden.

The problem is that when I click the image when the Qtip is being shown the Qtip hides for only a brief moment and then reappears.

JAVASCRIPT Code
$('a.avatar-thumbnail').each(function() { 
      $(this).qtip({
         content: {
            title: {
              text: '<a href="' + $(this).attr('href') + '">' +  $(this).children("img.thumbnail").attr('alt') + '</a>',
              button: 'Close',
            },
            text: '<span class="throbber-small">Loading...</span>',
            ajax: {
              url: $(this).attr('href') + ' span.flag-subscribe',
              //url: $(this).attr('href') + ' h1, span.flag-subscribe'
            }
         },
         position: {
            my: 'top center',
            at: 'bottom center',
            effect: false,
         },
         show: {event: 'click', solo: true, effect:false, delay:50},
         hide: {event: 'click unfocus', fixed: true, effect:false, delay:0}, 
      });
   });
Find all posts by this user
Quote this message in a reply
6th February, 17:58
Post: #2
RE: Troubles with hiding Qtip on click+unfocus
Try removing click from the hide event and just use unfocus

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
6th February, 19:30 (This post was last modified: 6th February 19:32 by walker2238.)
Post: #3
RE: Troubles with hiding Qtip on click+unfocus
Hey Craig,

I've tried that with the same result. If I click anywhere except the selector element than everything works fine. But when clicking the selector element with Qtip shown Qtip closes for a brief moment then reappears.

I should also mention that the reason I use click and unfocus is because I saw another forum post in which this did indeed create the desired outcome. However I do remember the example wasn't using an ajax call, so could this be a bug?

Also not sure if it helps but I'm testing this in FF9 and Chromium.
Find all posts by this user
Quote this message in a reply
6th February, 20:44
Post: #4
RE: Troubles with hiding Qtip on click+unfocus
Please setup a test case: http://jsfiddle.net/fdavn/

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
7th February, 00:34 (This post was last modified: 7th February 01:07 by walker2238.)
Post: #5
RE: Troubles with hiding Qtip on click+unfocus
I've set up a quick example but it's just a copy of my localhost (Drupal 7) so a lot of things might be messed up.

I've narrowed down the issue I believe. When I use an anchor with a text title it seems that Qtip behaves. The problem and my user case is that using an image instead of the text causes this.

http://jsfiddle.net/fDavN/2626/
Find all posts by this user
Quote this message in a reply
7th February, 17:09
Post: #6
RE: Troubles with hiding Qtip on click+unfocus
You're applying it to the <a> element which has different dimensions than the image itself. Make the image a block element using "display: block;" as by default it's inline and hence has line-spacing. http://jsfiddle.net/fDavN/2631/

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
7th February, 18:57
Post: #7
RE: Troubles with hiding Qtip on click+unfocus
(7th February 17:09)Craig Wrote:  You're applying it to the <a> element which has different dimensions than the image itself. Make the image a block element using "display: block;" as by default it's inline and hence has line-spacing. http://jsfiddle.net/fDavN/2631/

I'm not sure I understand.

The second example (Just the link without an image) was just to show the desired effect. You'll notice that for that link when the Qtip is shown that you can hide it by clicking either the link or anywhere else on the page.

But you'll notice that with the image nested in the link that when you click the image itself to hide it it flickers. The recommended styling you gave doesn't fix this.
Find all posts by this user
Quote this message in a reply
7th February, 19:32
Post: #8
RE: [Solved] Troubles with hiding Qtip on click+unfocus
Ah my bad sorry, wasn't paying attention to the thread title when I wrote that. This is actually a bug in the unfocus code, try the jsFiddle link now with the latest code (clear cache) and it should work.

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
7th February, 23:40
Post: #9
RE: [Solved] Troubles with hiding Qtip on click+unfocus
(7th February 19:32)Craig Wrote:  Ah my bad sorry, wasn't paying attention to the thread title when I wrote that. This is actually a bug in the unfocus code, try the jsFiddle link now with the latest code (clear cache) and it should work.

Perfect, thank you so much for your time.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Solved] Closing on click only on target and stop youtube video Monoski 2 30 20th May 21:24
Last Post: Monoski
  [Solved] Changing HTML Content on Click & Slider Impementation ifthatdoesntdoit 8 534 15th May 06:15
Last Post: ifthatdoesntdoit
  On Click need to call a javascript method potham 2 101 5th May 17:39
Last Post: Craig
  [Solved] Ajax link only on mouseover not on click argeee 2 120 23rd April 14:00
Last Post: argeee
  Reference form element values on hover, set to modal on click CueTip 1 220 25th March 14:44
Last Post: Craig
  [Solved] Hover & Click Functionality neandertal 3 338 1st March 16:03
Last Post: neandertal
  [Solved] target: mouse does not render at mouse click position msavona 2 333 31st January 19:33
Last Post: msavona
  [Solved] Click Event Inheritance/Bug jimbo8098 3 496 13th October 08:12
Last Post: jimbo8098
  [Solved] Automatically hiding modal window after N seconds andufo 4 1,029 11th October 16:15
Last Post: andufo
  Validation message not hiding on tab changes bitse 1 636 21st September 12:51
Last Post: Craig



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