SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast freelancekaleem's Avatar
    Join Date
    Dec 2010
    Location
    Pakistan
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    fade in effect query problem?

    Hi Guys,
    I am using fade in effect script but when i expand it is not same as it has to be. I want this to be a smooth one, If you check in this url file:///D:/Warsi/NEWBASHARAH/HTML/index.html effect is not smooth one. new image come immediately. I don't want this.I want smooth effect. I try to plat with the code but able to fix the problem.
    Here is the code PLZZZ Help me.

    window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);

    var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

    function so_init()
    {
    if(!d.getElementById || !d.createElement)return;

    css = d.createElement('link');
    css.setAttribute('href','slideshow2.css');
    css.setAttribute('rel','stylesheet');
    css.setAttribute('type','text/css');
    d.getElementsByTagName('head')[0].appendChild(css);

    imgs = d.getElementById('rotator').getElementsByTagName('img');
    for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
    imgs[0].style.display = 'block';
    imgs[0].xOpacity = .99;

    setTimeout(so_xfade,6000);
    }

    function so_xfade()
    {
    cOpacity = imgs[current].xOpacity;
    nIndex = imgs[current+1]?current+1:0;
    nOpacity = imgs[nIndex].xOpacity;

    cOpacity-=.05;
    nOpacity+=.05;

    imgs[nIndex].style.display = 'block';
    imgs[current].xOpacity = cOpacity;
    imgs[nIndex].xOpacity = nOpacity;

    setOpacity(imgs[current]);
    setOpacity(imgs[nIndex]);

    if(cOpacity<=0)
    {
    imgs[current].style.display = 'none';
    current = nIndex;
    setTimeout(so_xfade,6000);
    }
    else
    {
    setTimeout(so_xfade,50);
    }

    function setOpacity(obj)
    {
    if(obj.xOpacity>.99)
    {
    obj.xOpacity = .99;
    return;
    }

    obj.style.opacity = obj.xOpacity;
    obj.style.MozOpacity = obj.xOpacity;
    obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
    }
    }

  2. #2
    SitePoint Addict bronze trophy AllanP's Avatar
    Join Date
    Sep 2010
    Location
    Australia
    Posts
    298
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Your URL refers to a file on your computer, not the internet. Can you please resend the link?


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
  •