|
Add click/toggle event to qtip title
|
|
16th April, 19:56
Post: #1
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks, Craig, for all your great work!
I am having problems adding a click event to the qTip title. I want the qTip content to slideUp when I click the qTip title and then slideDown on the next click. I tried both the toggle and click events on the qTip title, using the onShow API. In addition, when I was investigating, I noticed that when I click on the target element to show the qTip, it appears that onShow is triggered twice for one click (Do I see that in the show API source code, onShow() called in afterShow() once and then again later?). I tested in Firefox 2 and 3 and IE 7. Any help/info would be appreciated. JS Code
Thanks again. |
|||
|
16th April, 20:47
Post: #2
|
|||
|
|||
|
Add click/toggle event to qtip title
Hi ivan,
First off thanks for the report about calling onShow and onHide twice! I hadn't noticed I'd left those in there, good catch! In regards to your problem, I'd recommend using onRender instead, as that way you're not assigning the toggle every time the tooltip shows: JS Code
That should fix your problem (just tested it). Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
17th April, 20:07
Post: #3
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks, Craig. Using onRender works as advertised.
However, I discovered two new issues while using onRender. 1. In IE7, when I click the qTip title to slideUp the qTip content, the styling of the qTip 'breaks' if the qTip title is one line. 2. It appears the title button (that hides the qTip) propagates the click event to the title itself. When you hide the qTip with that button, it hides the qTip and then toggles the qTip content. Therefore, if you reclick the target element to reshow the qTip, the state of the qTip content has been toggled. I'm looking for the behavior here to be the same as when you click the target element to hide/show the qTip: the state of the qTip content does not change. Any suggestions? For the second issue, is there a simple way to stop the propagation (stopPropagation(), preventDefault()?) Thanks again. JS Code
|
|||
|
17th April, 20:44
Post: #4
|
|||
|
|||
|
Add click/toggle event to qtip title
Ivan,
Most callback functions are passed the event parameter by default, so if you include it in the onShow function declaration like so: JS Code
You can use stopImmediatePropogation() to stop the other events firing (in theory). Try it out and get back to me! Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
21st April, 16:23
Post: #5
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks again. I stopped the propagation in the onHide callback (that's what you meant, right?). It works in FF2 and FF3. Of course, it did not work in IE7.
To make it work in IE7 without errors, I had to make the following changes: 1. don't stop the propagation for events on the target element in the onHide callback (i.e. in this case, stop propagation only for the title button click event). JS Code
2. make an edit to the qtip source code. Change line 197 in beta4 from JS Code
to JS Code
It appears what we discussed above about the two calls to onHide makes a difference here. Note: for the second change, I also tested leaving afterHide as is and removing the second onHide callback (line 236) but it did not work for me. Test examples: JS Code
|
|||
|
29th April, 15:43
Post: #6
|
|||
|
|||
|
Add click/toggle event to qtip title
I just tried the test examples I submitted on Apr 21 with the latest version of qtip (rc2). They no longer work.
1. In Firefox, I get an error that "event has no properties" in my onHide callback. Therefore, testing for the event's currentTarget and even just stopping the propagation no longer works. I tested with both the as-is version of qtip rc2 and my edited version (see above). 2. In IE, I could not test the title button to 'hide' the qtip because it is no longer being shown. I found this to be the case with other examples as well. Suggestions? Also, let me know if it would help to submit a bug report. Thanks again. |
|||
|
29th April, 18:40
Post: #7
|
|||
|
|||
|
Add click/toggle event to qtip title
Hi ivan,
Thanks for pointing this out. It's actually a bug in the libraries button event binding which doesn't pass on the event as a parameter. I've fixed this in the latest branch revision. Latest branch revision code: http://bazaar.launchpad.net/~craig.craig...runk/files I've also added in an extra element reference to the button as self.elements.button in the latest revision, so your code can be shortened down to this: JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
30th April, 01:17
Post: #8
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks. I successfully used qtip rev32 to fix the problem I saw in Firefox. I also successfully used self.elements.button (I noticed that what I had before in onHide no longer works. Is that right?).
However, two issues. 1. IE7 still does not show the title button with rev32. To make it work, I edited rev32 (starting from line 1397) from JS Code
to JS Code
2. Some basic functionality broke between rc2 and rev32. The following example no longer works: JS Code
|
|||
|
1st May, 22:05
Post: #9
|
|||
|
|||
|
Add click/toggle event to qtip title
Hi ivan,
I definitely would not recommend using a 'qtip' class for your elements which are going to be assigned tooltips, as it may interfere with the qtip script. This isn't such a problem with the latest branch revisions, as the selectors have been updated to make them more specific. Thanks for pointing out the issue with rev32, this is now fixed and pushed to the branch in the newest revision. I've also incorporated part of the IE fix you posted. So upgrade and enjoy! Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
4th May, 16:01
Post: #10
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks again, Craig.
Oops, I did not mean to use the qtip class. I can imagine it could cause a conflict. I will definitely avoid it in the future ![]() rev34 fixes the second issue I mentioned in my last post. Thanks. However, two issues. 1. I still have the problem in IE7 with the title button. In order for me to see the title button, I edited rev34 (lines 1426-1428) from: JS Code
to JS Code
2. My adding multiple qtips with different events to a single target no longer works. It worked in beta4. JS Code
|
|||
|
5th May, 15:35
Post: #11
|
|||
|
|||
|
Add click/toggle event to qtip title
Hi ivan,
Thanks for pointing out those bugs. The first was caused by a missing speech mark which caused the style class to get ignored on the element. Doh! The second bug was caused by some faulty API access code in the rendering stage which is now fixed in the latest code revision. Make sure to upgrade! http://bazaar.launchpad.net/~craig.craig...runk/files Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
6th May, 22:34
Post: #12
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks again, Craig.
I upgraded to rev37 and, as you said, it fixed the second issue I mentioned in my last post. I just upgraded to rev40, and it fixed the first issue I mentioned in my last post (second issue is still fixed). In my testing, I noticed that an alternative to (lines 1433-1435 in rev40): JS Code
is JS Code
It appears that inline elements like the anchor tag that are created by jQuery will work in IE when you include the end tag. Also, I thought it would help to define a default class for the title button, after line 2028 in rev40: JS Code
|
|||
|
7th May, 12:28
Post: #13
|
|||
|
|||
|
Add click/toggle event to qtip title
Hi ivan,
Thanks for the code suggestions, and well spotted on the inline element creation, looks to be working great now. I've implemented both in the newest rev41. Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
8th May, 12:40
Post: #14
|
|||
|
|||
|
Add click/toggle event to qtip title
Hi Craig,
Thanks, I see the changes in the most current revision (47). In the new content section, I found line 1134 needs an edit, from: JS Code
to: JS Code
|
|||
|
8th May, 15:37
Post: #15
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks ivan, good spotting. Changed in the newest revision.
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
12th May, 13:01
Post: #16
|
|||
|
|||
|
Add click/toggle event to qtip title
Craig:
I see the change in the most current revision (48). Thanks. In the new jQueryStyle(), I found that line 1722 needs an edit in order to work in IE7, from: JS Code
to: JS Code
|
|||
|
12th May, 18:53
Post: #17
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks ivan, implemented this as of revision 50.
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
13th May, 13:14
Post: #18
|
|||
|
|||
|
Add click/toggle event to qtip title
Thanks again, Craig. I just tried rev. 52 and everything looks great.
|
|||
|
25th June, 15:24
Post: #19
|
|||
|
|||
|
Add click/toggle event to qtip title
For a demo of implementing a button next to the title close button that will minimize/maximize the qtip content, please see http://craigsworks.com/projects/qtip/for...ent-title/.
|
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)

Search
Member List
Calendar
Help





