Ticket: https://mootools.lighthouseapp.com/projects/24057-mootoolsmore/tickets/290
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of soundseller Sent: Wednesday, March 24, 2010 12:09 PM To: MooTools Users Subject: [Moo] Re: Tooltips / JSON Question Hey Matthew, thanks for taking your time. Hopefully this will be fixed soon. Cheers On Mar 24, 6:09 pm, "Matthew Hazlett" <[email protected]> wrote: > ok, upon closer inspection I see there is an issue with the passed in > parameter. el is not reflecting the caller object. However there is a > workaround cheesy as it may be. > > http://mootools.net/shell/GjkeU/ > > var myTips = new Tips('.thisisatooltip', { > onShow: function(tip, el) { > tip.fade('in'); > thisTip = tip.getElement(".tip-title").get("html"); > // doWhatever(thisTip); > } > > }); > > Maybe a core dev can look into this problem. > > > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of soundseller > Sent: Wednesday, March 24, 2010 9:14 AM > To: MooTools Users > Subject: [Moo] Re: Tooltips / JSON Question > > Hello Matthew, > thanks for the advice. > You have been really helpful and kind. > > I have already tried all the stuff you are trying to tell me(in my > initial post I already tried to get the element using > el.get("alt") ), but the problem is > that none of that worked -> > > ...onShow: function(tip,el) { > tried this > var term = el.getAttribute('term'); > and > var term = el.get('alt'); > and > var term = el.get('whatever'); > or > var term = $(el).get('whatever'); > > ... > I know how to get an elements property. > What I don't know is how to get the elements property of the currently > hovered tooltip link - from within the "onShow" function. > > I thought that the "hovered element" is being passed to the "onShow" > function > > "...onShow: function(tip, el <-hovered element? ) {" > > but all I get if I try to use el.get("alt") is "Object [object Object] > has no method 'get'" > > Oh well - sun is shining - gonna get my shorts now - off to the court! > > On Mar 24, 4:37 pm, "Matthew Hazlett" <[email protected]> wrote: > > Use a tag that exists already like alt. > > > This is all I can suggest to you, all you have to do is read the > > documentation. If you can't figure it out from all these hints then you > > should think about taking up tennis. I don't even think you are trying. > > > <a id="foo" alt="Tennis is fun">Serve</a> > > alert( $("foo").get("alt") ); // Prints out Tennis is fun > > > Also look > here:http://mootools.net/docs/more/Interface/Tipshttp://mootools.net/docs/co > re/Element/Element#Element:get > > > -----Original Message----- > > From: [email protected] > > > [mailto:[email protected]] On Behalf Of soundseller > > Sent: Wednesday, March 24, 2010 4:38 AM > > To: MooTools Users > > Subject: [Moo] Re: Tooltips / JSON Question > > > Hi, > > thnx for your reply. > > I tried to get a value from the hovered element(term): > > > <a href="#" class="tips" term="Germany">Germany</a> > > > I thought that according to the docs the above element gets passed as > > "el" to the > > > ...onShow: function(tip,el) { > > var term = el.getAttribute('term');... > > > function and that I could retrieve it like this: > > > var term = el.getAttribute('term'); > > > But I get an error: > > > Object [object Object] has no method 'getAttribute' > > > So I tried it like this: > > > var term = $(el).getAttribute('term'); > > > Doesn't work either. > > Will keep on trying. > > Cheers > > > On Mar 24, 2:50 am, "Matthew Hazlett" <[email protected]> wrote: > > > I don't know why kind of data you are trying to pass, but it's really > easy > > > to do (it's just calling a function). I'm not going to write it for > you, > > > you need to keep trying but you are on the right path. > > > > I'll give you a hint, pass two variables to get_content one is the tip > > > object the other you need to figure out for yourself. > > > > You can also look at this (they may or may not be what you > > want)http://mootools.net/docs/more/Interface/Tipshttp://mootools.net/docs/co > > re/Element/Element#Element:gethttp://mootools.net/docs/core/Element/Element# > > Element:storehttp://mootools.net/docs/core/Element/Element#Element:retrieve > > > > -----Original Message----- > > > From: [email protected] > > > > [mailto:[email protected]] On Behalf Of soundseller > > > Sent: Tuesday, March 23, 2010 3:45 PM > > > To: MooTools Users > > > Subject: [Moo] Re: Tooltips / JSON Question > > > > Hi Matthew, > > > thanks for your patience. > > > > As I pointed out in my first post I want to pass a variable to the > > > request function. > > > This variable I want to get from the tooltip element(currently hovered > > > element). > > > > It says in the docs(Yes, I did take a look at them :) "The default > > > function for the show event, passes the tip element and the currently > > > hovered element." > > > > Thats why I thought I could do sth like this: > > > > ...onShow: function(tip,el) { > > > var term = el.getAttribute('term');... > > > or this: > > > > ...onShow: function(tip,el) { > > > var term = $(el).get('rel');... > > > > But that does not work. > > > So I came up with all that crazy stuff. > > > Any help is appreciated. > > > > On Mar 23, 11:29 pm, "Matthew Hazlett" <[email protected]> wrote: > > > > Why are you using an each loop then, just update one not all :/ > > > > (RTFM might help too) :-) > > > > >http://mootools.net/docs/core > > > > > Instead of: > > > > > onShow: function(tip,el) { > > > > tip.fade('in'); > > > > var ttips = $$('a.tips'); > > > > ttips.each(function(element,index) { > > > > get_content(element.getAttribute('term')); > > > > }); > > > > }, > > > > > Just use: > > > > > onShow: function(tip,el) { > > > > tip.fade('in'); > > > > get_content(tip); > > > > }, > > > > > -----Original Message----- > > > > From: [email protected] > > > > > [mailto:[email protected]] On Behalf Of soundseller > > > > Sent: Tuesday, March 23, 2010 2:50 PM > > > > To: MooTools Users > > > > Subject: [Moo] Re: Tooltips / JSON Question > > > > > Hi Matthew, > > > > thanks for your help. > > > > The problem is, that if I have several links with tooltips attached, > > > > everytime one of them > > > > is hovered, the requests for all of them are fired. > > > > >http://mootools.net/shell/RVAeU/6/ > > > > > Hmmm... > > > > Any help is appreciated. > > > > > On Mar 23, 10:01 pm, "Matthew Hazlett" <[email protected]> wrote: > > > > > Yes, your code makes no sense. > > > > > > When you hover and show the tool tip you are adding an event to > reset > > > the > > > > > tool tip next time it is shown. > > > > > You need to execute the updater on that iteration not the next one. > > > > > >http://mootools.net/shell/RVAeU/5/ > > > > > > -----Original Message----- > > > > > From: [email protected] > > > > > > [mailto:[email protected]] On Behalf Of soundseller > > > > > Sent: Tuesday, March 23, 2010 12:55 PM > > > > > To: MooTools Users > > > > > Subject: [Moo] Re: Tooltips / JSON Question > > > > > > So I tried sth else, which is terrible code, but maybe you can see > > > > > what I am > > > > > trying to do and give me some support. > > > > > It works only on the second hover. > > > > > >http://mootools.net/shell/RVAeU/4/ > > > > > > Thnx > > > > > > To unsubscribe from this group, send email to > > > > > mootools-users+unsubscribegooglegroups.com or reply to this email > with > > > the > > > > > words "REMOVE ME" as the subject. > > > > > To unsubscribe from this group, send email to > > > > mootools-users+unsubscribegooglegroups.com or reply to this email with > > the > > > > words "REMOVE ME" as the subject. > > > > To unsubscribe from this group, send email to > > > mootools-users+unsubscribegooglegroups.com or reply to this email with > the > > > words "REMOVE ME" as the subject. > > > To unsubscribe from this group, send email to > > mootools-users+unsubscribegooglegroups.com or reply to this email with the > > words "REMOVE ME" as the subject. > > To unsubscribe from this group, send email to > mootools-users+unsubscribegooglegroups.com or reply to this email with the > words "REMOVE ME" as the subject. To unsubscribe from this group, send email to mootools-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject. To unsubscribe from this group, send email to mootools-users+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
