views:

58

answers:

2

I have the following code:

    $(document).ready(function()
    {
        if (!jQuery.browser.msie)
        {
            $('.banner').cycle({
                fx: 'fade',
                speed: 1000,
                timeout: 10000,
                random: 1
            });
        }
        else {
            $('.banner').cycle({
                fx: 'turnUp',
                speed: 1000,
                timeout: 10000,
                random: 1
            });
        }
    });

However the .banner does not cycle in IE. If I change the Fx to fade though it will work?? Any ideas why I can't have a different effect, the IF and ELSE is defo working, just seems to break when I have a different effect on the IE one.

Thanks,

A: 

Turns out I wasn't using the latest version of Cycle. Not sure why this would effect the IF and ELSE statement though :/

Cameron
A: 

The plugin version is the likely culprit here, upgrade that to resolve the issue. Also, you can slim this down with a conditional statement, like this:

$(function() {
  $('.banner').cycle({
     fx: $.support.opacity ? 'fade' : 'turnUp',
     speed: 1000,
     timeout: 10000,
     random: 1
  });
});

This uses jQuery.support to check for opacity support, using feature detection rather than browser detection (IE9 for example does support opacity)...if at all possible, this is the best way to go.

Nick Craver