SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2008
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question JS help for Apple Widget

    I'm working on a Apple Widget and I have a question for the JS part of it.

    I want multiple elements to fade out when the widget loads up, I can get one element to fade out, but how do I get multiple elements to fade out on the same onLoad event.

    Here is the code to get one item to fade out.
    Code:
    function elementHide(event)
    {
    // Values you provide
    var itemToFadeOut = document.getElementById("img"); // replace with name of element to fade
    
    // Fading code
    var fadeHandler = function(a, c, s, f){ itemToFadeOut.style.opacity = c; };
    new AppleAnimator(5, 13, 1.0, 0.0, fadeHandler).start();
    
    }
    Any Help will be appreciated.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Something like this?

    Code javascript:
    function elementHide(id)
    {
    // Values you provide
    var itemToFadeOut = document.getElementById(id); // replace with name of element to fade
     
    // Fading code
    var fadeHandler = function(a, c, s, f){ itemToFadeOut.style.opacity = c; };
    new AppleAnimator(5, 13, 1.0, 0.0, fadeHandler).start();
     
    }

    Then call it with
    elementHide('myDiv');
    elementHide('someOtherID');
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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