views:

20

answers:

1

IE6 and 7 return a js error "expected identifier, string or number" on this :

function fadeopacity (){

  var opacity = $("#pics_list > li:first").css("opacity");

  $("#pics_list > li").hover( 

     function () {

          $(this).stop().animate({
        opacity: 1,
       }, 300, null)},
                             ->this is the line with an error? 
     function () {

      $(this).stop().animate({
       opacity: opacity,
      }, 200, null)}

  ) 
 }

which blocks all the page's scripts, this doesn't happen in IE8, and of course in every other browser out there

+2  A: 

I believe you're getting errors on these lines:

opacity: 1,
//and...
opacity: opacity,

Trailing commas tend to make IE angry :)

When you put the first on a single line it gets more apparent, like this:

.animate({ opacity: 1, }, 300, null)

Just remove the trailing comma in each place and see if you get any complaints then.

Nick Craver
+1 that is it i think.
Sarfraz
lol I didn't even see it, thanks that was it
Sandro Antonucci
since we're here, do you know how to reset back the original opacity in IE? that doesn't work in IE, plus on mouseover the images change opacity correctly but it starts from black??
Sandro Antonucci
@Sandro - You can use `opacity: "toggle"` instead :)
Nick Craver
why and how? :P
Sandro Antonucci
@Sandro - It sounds like you're probably experiencing is the IE alpha filter/cleartype bug, take a look at this question for details: http://stackoverflow.com/questions/457929/jquery-toggle-function-rendering-weird-text-in-ie-losing-cleartype
Nick Craver
maybe it is but I had to set opacity manually since IE is not reading .css("opacity") and the first time on mouseover it still fades from black, then it works ok. why?
Sandro Antonucci