Results 1 to 8 of 8

Thread: Ultimate Fade In Slideshow 1.5 Opera bug

  1. #1
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ultimate Fade In Slideshow 1.5 Opera bug

    1) Script Title: Ultimate Fade In Slideshow 1.5

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...nslideshow.htm

    3) Describe problem: The script doesn't do the fade in Opera 9. This will be a problem for any browser that uses the w3c opacity instead of the proprietary opacity filters/styles.

    Here is the fix:
    change
    PHP Code:
    else if (obj.tempobj.style.MozOpacity)
    obj.tempobj.style.MozOpacity=obj.degree/101
    else if (obj.tempobj.style.KhtmlOpacity)
    obj.tempobj.style.KhtmlOpacity=obj.degree/100 
    to:
    PHP Code:
    else if(typeof obj.tempobj.style.opacity)
    obj.tempobj.style.opacity=obj.degree/101
    else if (obj.tempobj.style.MozOpacity)
    obj.tempobj.style.MozOpacity=obj.degree/101
    else if (obj.tempobj.style.KhtmlOpacity)
    obj.tempobj.style.KhtmlOpacity=obj.degree/100 
    And change:
    PHP Code:
    else if (crossobj.style.MozOpacity)
    crossobj.style.MozOpacity=this.degree/101
    else if (crossobj.style.KhtmlOpacity)
    crossobj.style.KhtmlOpacity=obj.degree/100 
    to:
    PHP Code:
    else if(typeof crossobj.style.opacity)
    crossobj.style.opacity=this.degree/101
    else if (crossobj.style.MozOpacity)
    crossobj.style.MozOpacity=this.degree/101
    else if (crossobj.style.KhtmlOpacity)
    crossobj.style.KhtmlOpacity=this.degree/100 
    Last edited by techywarrior; 04-20-2007 at 05:38 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Not quite. You need to check (for the benefit of IE 5 or 4) for support for filters when you check opacity. And, typeof is always true (even when it returns a string value of 'undefined') so:

    Code:
    else if (obj.tempobj.style.opacity&&!obj.tempobj.filters) 
    obj.tempobj.style.opacity=obj.degree/101
    and similarly for your other change or else any browser that doesn't support either IE filters or style.opacity will throw an error. The check for filters is needed only for a specific version of IE that doesn't support the alpha filter but thinks that it does support opacity when, it does not. Also, this was always wrong in the script and I never knew why it wasn't fixed:

    Code:
    else if (crossobj.style.MozOpacity) 
    crossobj.style.MozOpacity=this.degree/101 
    else if (crossobj.style.KhtmlOpacity) 
    crossobj.style.KhtmlOpacity=obj.degree/100
    else if (crossobj.style.opacity&&!crossobj.filters) 
    crossobj.style.opacity=this.degree/101
    Obviously, it should be 'this'. Notice, I put the check for opacity last, this is also important as, it will prevent any browser that can do one of the others from even trying opacity when, they might mistakenly think that they could use it.

    Testing for opacity in this way also requires that the document.write part of the script actually includes opacity in the style for the two rotating divisions*.

    I was on a campaign when the script first came out for DD to make these changes but, I never was able to get through. It would be a very nice improvement to an otherwise fantastic script.



    *your method avoids this because:

    Code:
    else if (typeof crossobj.style.opacity)
    is always true as long as crossobj.style exists. But, that makes it a faulty test. It might as well just be:

    Code:
    else
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oops, the lines should be:
    PHP Code:
    else if(typeof obj.tempobj.style.opacity != 'undefined'
    and
    PHP Code:
    else if(typeof crossobj.style.opacity != 'undefined'
    They should however continue to be placed first since it is better that the browser use the w3c standard method then a proprietary one that it may also support.
    Last edited by jscheuer1; 04-20-2007 at 06:56 PM. Reason: add needed space to 1st code block

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by techywarrior View Post
    They should however continue to be placed first since it is better that the browser use the w3c standard method then a proprietary one that it may also support.
    That's debatable, I will leave that up to you but, with a true test like that, you still need to shield legacy browsers as indicated in my previous post. And, I believe the elements must still expressly be given inline style opacity in the document.write section of the script.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    That's debatable, I will leave that up to you but, with a true test like that, you still need to shield legacy browsers as indicated in my previous post. And, I believe the elements must still expressly be given inline style opacity in the document.write section of the script.
    ok, well I don't plan on rewriting someone elses function but the changes I made covers 99.9+% of the users on my site so it will do for now. I believe that legacy browsers will still work the way the script is written. They will fail all of the checks and the script does an image swap with no fade effect.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by techywarrior View Post
    I believe that legacy browsers will still work the way the script is written. They will fail all of the checks and the script does an image swap with no fade effect.
    Nope. V 4 browsers, yes, except that they never even test for opacity. It gets tricky in the early to mid 5's with IE, perhaps others. But, you can do it any way you like.

    BTW, the Swiss Army slide show can look just like this script, does incremental loading, and can also do much more while at the same time having none of these problems.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    BTW, the Swiss Army slide show can look just like this script, does incremental loading, and can also do much more while at the same time having none of these problems.
    hehe, I see you just happened to have written the Swiss Army slide show. I was looking at that program for something else but my concept was shot down so I don't think I will get to impliment it. Does it allow variable speed?

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by techywarrior View Post
    hehe, I see you just happened to have written the Swiss Army slide show. I was looking at that program for something else but my concept was shot down so I don't think I will get to impliment it. Does it allow variable speed?
    Well, if you want something done . . . very astute of you to notice. Sure, if you mean the pause between slides. It defaults to 3000 ms but, can be configured in either the call or as a property of the array.

    The fade rate is hard coded but, it could (and has already in these forums) be easily changed or made into a configuration option. See:

    http://www.dynamicdrive.com/forums/s...ad.php?t=19403
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •