[code=text] var term = el.get('rel'); [/code]
The above code does not work inside the "onShow" function.(Object
[object Object] has no method 'get')
[code=text]
var tipz = new Tips('.tips',{
className: 'tips',
fixed: false,
hideDelay: 50,
showDelay: 50,
onShow: function(tip,el) {
var term = el.get('rel');
tip.fade('in');
var req = new Request.JSON({
method: 'get',
noCache:true,
url: 'ajax.php',
data: { 'term' : term},
onRequest: function() {$$('.tip-
text').set('html','<div>loading</div>'); },
onComplete: function(response) {
$$('.tip-title').set('html','<strong>'+response.header
+'</strong>');
$$('.tip-text').set('html','<img src="'+response.image
+'"/><strong>'+response.content+'</strong>');
}
}).send();
},
onHide: function(tip,el) {
tip.fade('out');
}
});
[/code]
How would you do this?
Any ideas?
Thx in advance
Looks like you whould wrap it in $() -- also, pop this in a MooShell
for more help.
-- Sandy
On Mar 23, 12:33 am, Sanford Whiteman <sa...@cypressintegrated.com>
wrote:
On Mar 23, 12:22 pm, soundseller <soundsel...@googlemail.com> wrote:
> Thnx for your reply, I will try it out.http://mootools.net/shell/RVAeU/1/
http://mootools.net/shell/RVAeU/4/
Thnx
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/
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.
http://mootools.net/shell/RVAeU/6/
Hmmm...
Any help is appreciated.
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);
},
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.
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/Tips
http://mootools.net/docs/core/Element/Element#Element:get
http://mootools.net/docs/core/Element/Element#Element:store
http://mootools.net/docs/core/Element/Element#Element:retrieve
<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" <hazl...@gmail.com> 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/core/Element/Element#Element:gethttp://mootools.net/docs/core/Element/Element#Element:storehttp://mootools.net/docs/core/Element/Element#Element:retrieve
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/Tips
http://mootools.net/docs/core/Element/Element#Element:get
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" <hazl...@gmail.com> 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/core/Element/Element#Element:get
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.
In the Tip class this can be fixed by changing
"show: function(element){" to "show: function(obj, element){"
Working example at:
http://mootools.net/shell/u5wbL/
On Mar 25, 12:49 am, Aaron Newton <aa...@iminta.com> wrote:
> Yes. Tips was/is passing the wrong arguments here. I've fixed it:
>
> http://github.com/mootools/mootools-more/commit/0a0c03ff41334a432e2e0...
>
> for the next release.
>
>
>
> On Wed, Mar 24, 2010 at 1:38 PM, Matthew Hazlett <hazl...@gmail.com> wrote:
> > Ticket:
> >https://mootools.lighthouseapp.com/projects/24057-mootoolsmore/ticket...
> > 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://