...

View Full Version : YUI window onload not working in IE



roundr4
05-29-2007, 12:43 PM
Hello. My first post.

I am trying to create a web poll and use the Yahoo UI Library (YUI) to put some action in the percent bar when showing the poll results. It will start the bar at 100px wide and the retreat back to the percentage of the results. This works in Firefox (although once in awhile it stays at 100% and I need to hit refresh, don't know why) but it will not work at all in IE.

The example the yahoo people give is very similar to what I have here, but they use document, 'click' while I use window, 'load'. I don't want to make someone click on it in order for the movement to take place. So I figured just adding window, 'load' would do the trick. It does in FF, but I can't figure out why it doesn't work in IE. I do not get any error messages. Hoping there are some people that have worked with the YUI before.

Also, anyone know why a bar height of 6px in FF looks nice, but in IE it is twice as high?


You can find this located at:
http://www.couchmanagers.com/poll2.php?pollid=5




<script>

YAHOO.example.init = function() {
var anim = new YAHOO.util.Anim('o1', { width: {to: 66}});

YAHOO.util.Event.addListener(window, 'load', anim.animate, anim, true);
};

YAHOO.util.Event.onAvailable('o1', YAHOO.example.init);



YAHOO.example.init = function() {
var anim = new YAHOO.util.Anim('o2', { width: {to: 0}});

YAHOO.util.Event.addListener(window, 'load', anim.animate, anim, true);

};

YAHOO.util.Event.onAvailable('o2', YAHOO.example.init);


YAHOO.example.init = function() {
var anim = new YAHOO.util.Anim('o3', { width: {to: 33}});

YAHOO.util.Event.addListener(window, 'load', anim.animate, anim, true);

};

YAHOO.util.Event.onAvailable('o3', YAHOO.example.init);


</script>

roundr4
06-01-2007, 03:22 AM
Got it working. IE didn't like the multiple window 'load' calls, while Firefox didn't mind it. Only real issue now is that it doesn't always work in Firefox.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum