Shadowbox make some jquery plugins not working in IE7

classic Classic list List threaded Threaded
7 messages Options
MGD
Reply | Threaded
Open this post in threaded view
|

Shadowbox make some jquery plugins not working in IE7

MGD
If a reference of shadowbox.js is present some JQuery plugins such as Flexigrid or idTabs does not work correctly. In FF2 all is ok. I used the jquery adapter and $(document).ready(function() ... and attempted with uncompressed 1.2.3, 1.2.4 and 1.2.6 versions of jequery but plugins still not working. Is there a workaround? Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox make some jquery plugins not working in IE7

Wizzud
Do you have a web-accessible example page?
Combine literacy with curiosity and a whole world of information opens up to you
MGD
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox make some jquery plugins not working in IE7

MGD
You can found the page at http://test.gipa54.it/ ( I updated the dns 2 hours ago so it is possible you cannot resolve the ip and you have to wait some hours ).

The page contains jquery, idTabs plugin and shadowbox and works in firefox but not in ie7.
Removing shadowbox reference the tab plugin works both in IE7 and FF2. Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox make some jquery plugins not working in IE7

Wizzud
This post was updated on .
Right.
Shadowbox sets up a prototype method on Array for indexOf().
The idTabs plugin uses a for...in loop to iterate through the elements of 2 arrays.
The for...in loop processes not only the numerically indexed elements of the array, but also the 'indexOf' function added by Shadowbox. At this point IE objects.

Solution: 2 choices...

A. Modify the idTabs plugin to not use a for...in loop to iterate through arrays...
Edit idTabs code:
- find

   for(i in aList)

  and replace with

   var i=aList.length;while(i--)

- find

   for(i in idList)

  and replace with

   i=idList.length;while(i--)

B. Or, alternatively, modify shadowbox.js...
Edit shadowbox.js code:
- find the assertKey() function and change

        return (valid.indexOf(key) != -1 || valid.indexOf(code) != -1);

  to

        var i = valid.length, f = false;
        while(!f && i--){
          f = (valid[i] == key || valid[i] == code);
        }
        return f;

- find the declaration of the indexOf prototype method for Array (bottom of code)...

Array.prototype.indexOf = Array.prototype.indexOf || function(o){
    for(var i = 0, len = this.length; i < len; ++i){
        if(this[i] == o){ return i; }
    }
    return -1;
};

  and comment it out (or remove it).

I think the assertKey() is the only function that utilises the Array.indexOf() functionality.

Combine literacy with curiosity and a whole world of information opens up to you
MGD
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox make some jquery plugins not working in IE7

MGD
Thank you very much, Wizzud!

your answer had my five-star rate.

Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox make some jquery plugins not working in IE7

Wizzud
I've just updated my previous post to add a missing 'return f;' to the editted shadowbox code - failed to copy/paste it in first time through, sorry.
Combine literacy with curiosity and a whole world of information opens up to you
MGD
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox make some jquery plugins not working in IE7

MGD
Don't worry, your post was very useful.

Thanks again.