Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    YUI window onload not working in IE

    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

    Code:
    <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>

  • #2
    New to the CF scene
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •