|
hide on background click
|
|
24th March, 20:26
Post: #1
|
|||
|
|||
|
hide on background click
I'm bringing up a qtip:
JS Code
I would like the qtip to disappear by either
Can anyone help me acheive this? Is something wrong in my declaration? |
|||
|
25th March, 01:59
Post: #2
|
|||
|
|||
|
hide on background click
Hi rseshadr,
I'm actually using that exact setup for my documentation page examples. Here's the the code that will do it for you (Although probably not the best way to do): JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
25th March, 21:55
Post: #3
|
|||
|
|||
hide on background click
craig Wrote:Hi rseshadr, Craig, thanks for the quick reply, this works but not quite fully...
As it stands I think I'm going to leave my tip functionality as-is, but I will request a feature to be able to configure a tooltip to toggle on click of it's target element. |
|||
|
25th March, 22:16
Post: #4
|
|||
|
|||
|
hide on background click
reshadr,
Looking over your code I noticed you've got both hide and show set to a click event, which at the moment isn't supported very well. This is probably the reason you're experiencing the toggling twice etc. Try changing one to mouseup/down and try different combinations, that should fix it for now until beta4 is released. In regards to the iframe, clicks outside the frame? You mean when you click anywhere else on the document it doesn't hide? Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
26th March, 13:26
Post: #5
|
|||
|
|||
|
hide on background click
I am having a related problem and I thought I would add to this thread rather than creating my own.
I too want a tip that disappears when the user clicks anywhere outside of the tooltip. But in my case, my application makes extensive use of AJAX to load new content onto the page as the user interacts with the site. This leads to two problems with the "hide.when.target=$(document.body).children().not($(self))" solution: (1) That solution registers an event handler on lots of DOM elements for closing each tooltip as it gets opened. If the user opens a bunch of tooltips the number of event handlers in the event handler chains will grow. Since in my application the user stays on the same page for a longer period of time (as new content is dynamically added and moved) I fear that the number of event handlers will grow to the point where performance becomes a problem. However, I have not actually observed this problem -- perhaps I am worrying unnecessarily. (2) The existing infrastructure registers the event handlers at the time that the tooltip is created. Any page elements which get added afterward will NOT have event handlers, and clicking on these will not close the tooltip. This problem is actually preventing my application from working. Ideally, I would want a single event handler for mousedowns anywhere which closed any open tooltips which did not contain the click. I would also be perfectly happy with using "hide.when.target=$(document.body).children().not($(self))" if I could get the code to run and the event handlers to be registered EVERY time the tooltip is displayed and removed when it is hidden (instead of being registered the FIRST time the tooltip is displayed). But I would strongly prefer not to modify or monkeypatch qTip (after all, I'd like to receive updates in the future!). Any suggestions? |
|||
|
27th March, 06:02
Post: #6
|
|||
|
|||
|
hide on background click
mcherm, craig,
Wouldn't that event-bubbling request from a different thread resolve this issue? |
|||
|
27th March, 07:26
Post: #7
|
|||
|
|||
|
hide on background click
Quite right rseshadr, and I was ahead of you on this one!
![]() I just implemented an 'unfocus' hide event type in beta4, which will allow you to hide tooltips when elements other than the tooltip and target element are clicked, without the need to bind excessive DOM handlers. This is a step towards the event delegation I want to implement library wide in 1.1. Releasing beta4 on the 28th guys so be patient! Just polishing off the demos and documentation section updates and then it will be all yours! Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
27th March, 12:47
Post: #8
|
|||
|
|||
|
hide on background click
That's fabulous! Thank you Craig.
|
|||
|
31st March, 01:03
Post: #9
|
|||
|
|||
|
hide on background click
Hi Craig,
That's really great! I was about to implement that to my code when I found this post. Are you releasing beta4 on the next few days? Thanks, -Alessandro |
|||
|
7th April, 16:49
Post: #10
|
|||
|
|||
|
hide on background click
Update to this thread regarding the beta 4:
This code now breaks in beta4: JS Code
It will hide when clicking anywhere outside the tip, but it will NOT hide when you reclick the item that brings up the tip. Instead the tip hides and reshows. In beta3 it would hide when clicking the item that calls the tip. Suggestions Craig? |
|||
|
7th April, 16:53
Post: #11
|
|||
|
|||
|
hide on background click
Hi xpand2,
This is now a native event in Beta4, which hides the tooltip when it loses focus e.g. anywhere except the tooltip is clicked: JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
7th April, 17:46
Post: #12
|
|||
|
|||
|
hide on background click
Beautiful! I love it! Thanks for the great work Craig
|
|||
|
30th April, 19:32
Post: #13
|
|||
|
|||
|
hide on background click
Newb Question:
Where the heck do you put those lines of code for the hide effect to work? I have this in the head tag of my page, and it doesn't work. JS Code
What I really want to do is that when someone clicks the image that is my content the qtip closes. I tried to use the images onclick event to call a javascript funtion that then uses API calls to close it. But the onclick event never gets fired or doesn't call my function. Any ideas? Thanks in advance. |
|||
|
1st May, 12:48
Post: #14
|
|||
|
|||
|
hide on background click
Hi huangjd,
Think you're a little confused as to what project this forum is geared towards. You're using Simpletip, the old library which I no longer actively develop for. The above code is for qtip only. Try updating to qTip first here: http://craigsworks.com/projects/qtip/download/ The equivalent code for the qTip project is this: JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
1st May, 18:49
Post: #15
|
|||
|
|||
|
hide on background click
Haha, that's funny. I accidentally downloaded simpletip and didn't even realize it.
One little problem, the unfocus is not what I want. How do I close the tooltip when the foreground ( the tooltip itself, or in my case the image) is clicked on. I've tried a number of things but can't seem to get it to work. |
|||
|
1st May, 20:05
Post: #16
|
|||
|
|||
|
hide on background click
Specify you're show target as your image:
JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
2nd May, 14:21
Post: #17
|
|||
|
|||
|
hide on background click
Don't you mean, the hide target should be the image? I had tried that already and can't get it to work. And your example doesn't do the trick either.
Also, why did you change the outer function from: $(document).ready(function() { to: $('#findGroup').each(function() To me it looks like it's doing the same thing just a different way. Is that correct? |
|||
|
2nd May, 23:12
Post: #18
|
|||
|
|||
|
hide on background click
Yeah that's what I meant, but the outer function isn't changed , I just forgot to include the document.ready part. The .each function allows you to access each elements properties via the this statement, so its needed for the fix to work.
JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
3rd May, 15:29
Post: #19
|
|||
|
|||
|
hide on background click
Couldn't you just make the hide target the qtip itself?
JS Code
Also, the code provided still doesn't work. Is it because the image is being wrapped in numerous divs? JS Code
|
|||
|
5th May, 17:50
Post: #20
|
|||
|
|||
|
hide on background click
Hi huangjd,
Sorry it took so lnog to get back to you, been very busy these past couple of days! Here's the code which should work for you. JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
15th November, 19:04
Post: #21
|
|||
|
|||
|
RE: hide on background click
Hi Craig,
I am using hide: 'unfocus' to close the qTip by clicking outside of it and this works fine. But not on an iPad. Your help is very appreciated. Thanks. Thilo |
|||
|
16th November, 19:46
Post: #22
|
|||
|
|||
|
RE: hide on background click
Unfortunately iPads are a bit tricky to develop for as... well I don't have one
Do click events fire normally on an iPad?
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
24th November, 11:08
Post: #23
|
|||
|
|||
|
RE: hide on background click
click events fire just fine.
In fact I do have the same issue on iTouch and iPhone. You might have one of those ;-) So it is only possible to close the qTip by clicking on my closing icon which is quite small. and when I zoom to click it the qTip centres itself again and moves out of view. |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)

Search
Member List
Calendar
Help






