PoPSiCLe
Apr 26th 2009, 11:26 am
Hey again.
Playing around with MooTools tooltip functions, and I've gotten one instance of them to work:
http://dev.bergenpchjelp.no/index.php?page=prisliste
They are working just fine. That one is using one implementation of the tooltip feature.
I've been trying to get the following to work on my site:
http://dev.bergenpchjelp.no/mootest.html (stolen that one, just to see if it would work if I just copied the values) <- it works fine on the test page
But if I try to use a couple of the functions on my own site, for instance there is a test here:
http://dev.bergenpchjelp.no/index.php?page=admin
it shows nothing.
For the testing, I'm using the following:
<p>Here we have a simple <span style="color:#FF6600" class="tipper" rel="{content:'tipContainer2',position:-1,target:'targeted'}">text element</span> to display the tooltip. It displays the tooltip on a remote element.</p>
for the link, and:
<div class="tipContainer" id="tipContainer2">Hey, I'm remote. Neat!</div>
<div style="margin-top:160px; clear:both;" id="targeted">I'm the remote display element. Here's where the tooltip will appear if you hover the orange text.</div>
for the display part. Just copied directly from the mootest.html above.
Then, I added the following script to my main.js file:
window.addEvent('load', function(){
new MooTooltips({
hovered:'.tipper', // the element that when hovered shows the tip
extra:{
0: {
'id':'extra',
'text':'this text is added manually using the extra.text parameter.',
'position':-1,
'sticky':false
},
1: {
'id':'other_extra',
'ajax':'ajax.php',
'ajax_message': 'Loading... please wait.',
'position':1,
'sticky':false
}
},
ToolTipClass:'ToolTips', // tooltip display class
toolTipPosition:1, // -1 top; 1: bottom - set this as a default position value if none is set on the element
showDelay: 100,
sticky:false, // remove tooltip if closed
fromTop: 0, // distance from mouse or object
fromLeft: -55, // distance from left
duration: 300, // fade effect transition duration
fadeDistance: 20 // the distance the tooltip starts the morph
});
});
All this, and nothing.
I've tried using firebug, and it reports an error:
$(el.id) is null
http://dev.bergenpchjelp.no/js/MooTooltips.js
Line 37
$(el.id) is null
(?)()()MooTooltips.js (line 37)
getClean()(function(), Object options=Object elements=[1])mootools.js (line 13)
initialize()(Object hovered=.tipper extra=Object ToolTipClass=ToolTips)MooTooltips.js (line 39)
initialize()()mootools.js (line 91)
(?)()()main_js.js (line 180)
run()()mootools.js (line 56)
E()(undefined)mootools.js (line 57)
cloneEvents()(function())mootools.js (line 181)
cloneEvents()("domready", undefined, undefined)mootools.js (line 182)
B()()mootools.js (line 256)
removeEvent()()mootools.js (line 175)
[Break on this error] $(el.id).set( 'rel', JSON.encode(el) );
The corresponding lines from MooToolstips.js is as follows:
var e = new Hash(this.options.extra);
e.each(function(el){
$(el.id).set( 'rel', JSON.encode(el) );
this.elements.include($(el.id));
},this);
this.currentElement = null;
this.attach();
},
I'm a bit stumped - I know the files work - I've gotten other functions to work, so the links to the different mootools-files and such are in place. I'm using Mootools 1.2.1, and the mootools-more-file, both the same as the ones in the original example. I've uploaded the imagefiles used in the example too, and I'm also using the original CSS-files in the header, so it should have any values corresponding. But no, it does not work.
Anyone have any idea as to why?
Playing around with MooTools tooltip functions, and I've gotten one instance of them to work:
http://dev.bergenpchjelp.no/index.php?page=prisliste
They are working just fine. That one is using one implementation of the tooltip feature.
I've been trying to get the following to work on my site:
http://dev.bergenpchjelp.no/mootest.html (stolen that one, just to see if it would work if I just copied the values) <- it works fine on the test page
But if I try to use a couple of the functions on my own site, for instance there is a test here:
http://dev.bergenpchjelp.no/index.php?page=admin
it shows nothing.
For the testing, I'm using the following:
<p>Here we have a simple <span style="color:#FF6600" class="tipper" rel="{content:'tipContainer2',position:-1,target:'targeted'}">text element</span> to display the tooltip. It displays the tooltip on a remote element.</p>
for the link, and:
<div class="tipContainer" id="tipContainer2">Hey, I'm remote. Neat!</div>
<div style="margin-top:160px; clear:both;" id="targeted">I'm the remote display element. Here's where the tooltip will appear if you hover the orange text.</div>
for the display part. Just copied directly from the mootest.html above.
Then, I added the following script to my main.js file:
window.addEvent('load', function(){
new MooTooltips({
hovered:'.tipper', // the element that when hovered shows the tip
extra:{
0: {
'id':'extra',
'text':'this text is added manually using the extra.text parameter.',
'position':-1,
'sticky':false
},
1: {
'id':'other_extra',
'ajax':'ajax.php',
'ajax_message': 'Loading... please wait.',
'position':1,
'sticky':false
}
},
ToolTipClass:'ToolTips', // tooltip display class
toolTipPosition:1, // -1 top; 1: bottom - set this as a default position value if none is set on the element
showDelay: 100,
sticky:false, // remove tooltip if closed
fromTop: 0, // distance from mouse or object
fromLeft: -55, // distance from left
duration: 300, // fade effect transition duration
fadeDistance: 20 // the distance the tooltip starts the morph
});
});
All this, and nothing.
I've tried using firebug, and it reports an error:
$(el.id) is null
http://dev.bergenpchjelp.no/js/MooTooltips.js
Line 37
$(el.id) is null
(?)()()MooTooltips.js (line 37)
getClean()(function(), Object options=Object elements=[1])mootools.js (line 13)
initialize()(Object hovered=.tipper extra=Object ToolTipClass=ToolTips)MooTooltips.js (line 39)
initialize()()mootools.js (line 91)
(?)()()main_js.js (line 180)
run()()mootools.js (line 56)
E()(undefined)mootools.js (line 57)
cloneEvents()(function())mootools.js (line 181)
cloneEvents()("domready", undefined, undefined)mootools.js (line 182)
B()()mootools.js (line 256)
removeEvent()()mootools.js (line 175)
[Break on this error] $(el.id).set( 'rel', JSON.encode(el) );
The corresponding lines from MooToolstips.js is as follows:
var e = new Hash(this.options.extra);
e.each(function(el){
$(el.id).set( 'rel', JSON.encode(el) );
this.elements.include($(el.id));
},this);
this.currentElement = null;
this.attach();
},
I'm a bit stumped - I know the files work - I've gotten other functions to work, so the links to the different mootools-files and such are in place. I'm using Mootools 1.2.1, and the mootools-more-file, both the same as the ones in the original example. I've uploaded the imagefiles used in the example too, and I'm also using the original CSS-files in the header, so it should have any values corresponding. But no, it does not work.
Anyone have any idea as to why?