Results 1 to 4 of 4

Thread: Another Bug in Ultimate Fade-in slideshow (v1.5)

  1. #1
    Join Date
    Apr 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Another Bug in Ultimate Fade-in slideshow (v1.5)

    Hi there,

    first one simple thing. I think that in the resetit function,

    Code:
    crossobj.style.KhtmlOpacity=obj.degree/100
    should be:

    Code:
    crossobj.style.KhtmlOpacity=this.degree/100
    The more serious problem is with certain IE6 settings where a check for a filter property fails with an "Unspecified error", e.g.:

    Code:
    if (crossobj.filters&&crossobj.filters[0]){
    I can not say what settings are actually responsible, but the problem popped up previously on these forums. What I did to make it at least work without the fading effect was to create a new SetIeOpacity function:

    Code:
    function SetIeOpacity(crossobj,degree)
    {
    try
    {
    if (crossobj.filters&&crossobj.filters[0]&&(typeof crossobj.filters[0].opacity=="number")){ //if IE6+
    crossobj.filters(0).opacity=this.degree
    return
    }
    }
    catch(e){}
    if(crossobj.style.filter)
    crossobj.style.filter="alpha(opacity="+degree+")"
    }
    and change the fadepic and resetit functions as follows:

    Code:
    function fadepic(obj){
    if (obj.degree<100){
    obj.degree+=10
    if(iebrowser&&dom) // if IE5+
    SetIeOpacity(obj.tempobj,obj.degree)
    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
    }
    else{
    clearInterval(fadeclear[obj.slideshowid])
    obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
    obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
    obj.populateslide(obj.tempobj, obj.nextimageindex)
    obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
    setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
    }
    }
    
    fadeshow.prototype.resetit=function(){
    this.degree=10
    var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
    if(iebrowser&&dom) // if IE5+
    SetIeOpacity(crossobj,this.degree)
    else if (crossobj.style.MozOpacity)
    crossobj.style.MozOpacity=this.degree/101
    else if (crossobj.style.KhtmlOpacity)
    crossobj.style.KhtmlOpacity=this.degree/100
    }
    I'm not sure if IE4 and the like would still stumble over try/catch even if it is in a function that is not called on these platforms. Maybe someone more experienced with this can replace the try/catch with onerror or suggest a better solution to catch the "Unspecified error".

    Best regards,
    Jens.

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jens_thiel
    I think that in the resetit function,

    Code:
    crossobj.style.KhtmlOpacity=obj.degree/100
    should be:

    Code:
    crossobj.style.KhtmlOpacity=this.degree/100
    Yes, it should.

    The more serious problem is with certain IE6 settings where a check for a filter property fails with an "Unspecified error", e.g.:

    Code:
    if (crossobj.filters&&crossobj.filters[0]){
    I can not say what settings are actually responsible, but the problem popped up previously on these forums.
    Assuming it's the same error, I experienced that with what was essentially a broken multiple-IE installation. The DirectX libraries used by IE (v5.0, in this instance) weren't available. However, it's possible that other circumstances could cause the problem (scripting security options, for example).

    A simple test that should suffice is to use the typeof operator. In the scenario above, the typeof returned an undocumented 'unknown' value. However, both the filters property, and the properties of that object, should evaluate to 'object'.

    Whilst we're on the subject of this expression, it's my opinion that the filters should be accessed by name. There's no guarantee that the Alpha filter will be the only one applied to an element, nor that it will be the first in the collection.

    Code:
    if ((typeof crossobj.filters == 'object')
        && (typeof crossobj.filters['DXImageTransform.Microsoft.Alpha'] == 'object')) {
      /* ... */
    }
    I'm chose to use the DirectX filter, above. However, it's quite trivial to negotiate between the two varieties to cope with IE 5.0x, for example, which can only handle the legacy version.

    I'm not sure if IE4 and the like would still stumble over try/catch even if it is in a function that is not called on these platforms.
    Yes, it would. Function declarations are parsed as they are encountered; they have to be so that the interpreter can know what constitutes the function body, and what follows it.

    Maybe someone more experienced with this can replace the try/catch with onerror or suggest a better solution to catch the "Unspecified error".
    The suggestion above should suffice, however the alternative is to use JScript's conditional compilation feature.

    Mike

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

    Default

    I had identified and fixed that first error in my more recent fix for Safari in this forum. I also had originally used a try/catch scheme for opacity tests in IE that wasn't even written unless the browser passed certain IE version specific conditional comment tests but was overruled by ddadmin, it is his script after all.
    - John
    ________________________

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

  4. #4
    Join Date
    Apr 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Hello Mike,

    the typeof test was a good idea and I could rewrite SetIeOpacity without the try/catch:

    Code:
    function SetIeOpacity(crossobj,degree)
    {
    if((typeof crossobj.filters!='unknown')&&crossobj.filters[0]&&(typeof crossobj.filters[0].opacity=="number")) //if IE6+
    crossobj.filters(0).opacity=degree
    else if(crossobj.style.filter)
    crossobj.style.filter="alpha(opacity="+degree+")"
    }
    Thanks,
    Jens.
    Last edited by jens_thiel; 04-11-2006 at 09:13 AM.

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
  •