Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jQuery Effect Not Working in IE7
Old 07-21-2009, 05:04 PM jQuery Effect Not Working in IE7
Junior Talker

Posts: 2
Name: Sarah
Trades: 0
Hello!
I created a simple slideshow using jQuery, and, for some reason, it doesn't work in IE7 (and maybe other versions of IE as well).

Here is the link: http://unitedfrontmn.org/website/

Please look at the top slideshow with the "1 2 3" controls. Click one of those numbers and notice that nothing happens in IE7. Everything works fine in Firefox, Safari, and Chrome.

My code is called from the head of the page and reads:

Code:
jQuery(document).ready(function(){
    var fcTransitionLength = 400;       
    jQuery(".button1").click(function(){         
        jQuery(".button1").css({'background-color' : '#7a7a7a', 'color' : '#fff'});
        jQuery(".button2").css({'background-color' : '#f3f3f4', 'color' : 'inherit'});
        jQuery(".button3").css({'background-color' : '#f3f3f4', 'color' : 'inherit'});
        jQuery(".image2").fadeOut(fcTransitionLength);
        jQuery(".fcText2").fadeOut(fcTransitionLength);
        jQuery(".image3").fadeOut(fcTransitionLength);;
        jQuery(".fcText3").fadeOut(fcTransitionLength,function(){
            jQuery(".image1").fadeIn(fcTransitionLength);
            jQuery(".fcText1").fadeIn(fcTransitionLength);});
    });
    
    jQuery(".button2").click(function(){
        jQuery(".button1").css({'background-color' : '#f3f3f4', 'color' : 'inherit'});
        jQuery(".button2").css({'background-color' : '#7a7a7a', 'color' : '#fff'});
        jQuery(".button3").css({'background-color' : '#f3f3f4', 'color' : 'inherit'});
        jQuery(".image1").fadeOut(fcTransitionLength);
        jQuery(".fcText1").fadeOut(fcTransitionLength);
        jQuery(".image3").fadeOut(fcTransitionLength);
        jQuery(".fcText3").fadeOut(fcTransitionLength,function(){
            jQuery(".image2").fadeIn(fcTransitionLength);
            jQuery(".fcText2").fadeIn(fcTransitionLength);});
    });
    
    jQuery(".button3").click(function(){
        jQuery(".button1").css({'background-color' : '#f3f3f4', 'color' : 'inherit'});
        jQuery(".button2").css({'background-color' : '#f3f3f4', 'color' : 'inherit'});
        jQuery(".button3").css({'background-color' : '#7a7a7a', 'color' : '#fff'});
        jQuery(".image1").fadeOut(fcTransitionLength);
        jQuery(".fcText1").fadeOut(fcTransitionLength);
        jQuery(".image2").fadeOut(fcTransitionLength);
        jQuery(".fcText2").fadeOut(fcTransitionLength,function(){
            jQuery(".image3").fadeIn(fcTransitionLength);
            jQuery(".fcText3").fadeIn(fcTransitionLength);});
    });

});
I have tried to solve the problem by moving my jQuery code to the bottom of my html, and trying different variable declarations.

Do you know why this is happening? Have any ideas?

Thank you!
Sarah
Sarah20 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-21-2009, 08:08 PM Re: jQuery Effect Not Working in IE7
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
The error is being thrown by jQuery itself, not one of your functions, so this is an exception of some sort being caused by bad input. My debugger tells me it is a "Invalid property value". Properties are the values of an object. In this case, it is most likely the CSS rules that are being inputted. "inherit" may not be a valid value for "color" in IE7 and below (I'm not sure). Eliminate all of the CSS rules to see if the problem stops, and if it does, start by looking for an alternate value to "inherit".
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 07-21-2009, 10:27 PM Re: jQuery Effect Not Working in IE7
Junior Talker

Posts: 2
Name: Sarah
Trades: 0
Thanks for the help!

The CSS code was, indeed, the culprit. Here's the code that ended up working in IE:

Code:
jQuery(document).ready(function(){
    var cssObj1 = {
        'background-color' : '#7a7a7a',
        'color' : '#fff'
        }
    jQuery(".button1").click(function(){    
        jQuery(".button1").css(cssObj1);
        jQuery(".button2").css("background-color","#f3f3f4");
        jQuery(".button2").css("color","#333");
    });
});
For some reason, it won't work if I use another object to control the css on ".button2". I must be doing something wrong there. For example, if I use the following code, it won't work:

Code:
jQuery(document).ready(function(){
    var cssObj1 = {
        'background-color' : '#7a7a7a',
        'color' : '#fff'
        }
    var cssObj2 = {
        'background-color' : '#f3f3f4',
        'color' : '#f3f3f4'
        }
    jQuery(".button1").click(function(){    
        jQuery(".button1").css(cssObj1);
        jQuery(".button2").css(cssObj2);
    });
});
Any idea why?

Thank you!
Sarah
Sarah20 is offline
Reply With Quote
View Public Profile
 
Old 07-21-2009, 10:37 PM Re: jQuery Effect Not Working in IE7
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Well, that is very strange indeed. Not sure why that wouldn't work. However, try doing this:
Code:
jQuery(document).ready(function(){
    var cssObj1 = {
        backgroundColor : '#7a7a7a',
        color : '#fff'
        }
    var cssObj2 = {
        backgroundColor : '#f3f3f4',
        color : '#f3f3f4'
        }
    jQuery(".button1").click(function(){    
        jQuery(".button1").css(cssObj1);
        jQuery(".button2").css(cssObj2);
    });
});
Property names don't always have to be expressed as strings. In fact , it not the norm to do so. jQuery uses the standard rule of allowing you to express CSS property names in camelCase whenever a dash would be used.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to jQuery Effect Not Working in IE7
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22917 seconds with 12 queries