views:

82

answers:

2

EDIT:

OP here. Well, the problem is at the jQuery.JS archive. I just downloaded the last one, uncompressed, and the error changed to line 4619 character 4.

I went to that line and there's an '}' symbol LOL... did i mention i hate internet explorer?

I have no idea how to fix this, it seems to be a bug within the framework :S


/EDIT

Well hi there! -I hate internet explorer :D-

I made an slide with jQuery to animate a little image galery.

http://www.imagina.com.uy/bentancorleborgne/?page_id=2

Works beautifully on Firefox, Safari and IE8.

However on IE7 and previous it gives an error. A message pops up saying:

Error on the script.

Line: 20

Character: 31759

Error: Invalid argument

URL: http-://www-.imagina.com.uy/bentancorleborgne/?page_id=2

I have a couple scripts running on that page, but since the error pops up when I try to slide the galery, I'm guessing the error comes from this code:

// JavaScript Document
$(document).ready(function() {
 var tablaWidth = parseFloat($('.imagenesWrapper table').css('width'), 10);
 var tdWidth = parseFloat($('.imagenesWrapper table tr td').css('width'), 10) + parseFloat($('.imagenesWrapper table tr td').css('margin-right'), 10);
 var cantCeldas = tablaWidth / tdWidth - 1;
 var posActual = 0;
 var leftCSS = 1;

 if(cantCeldas==1) {
     $('#leftArrow').hide();
     $('#rightArrow').hide();
 }else {
     $('#rightArrow').show();
 }

 $('#rightArrow').click(function() {
     if(leftCSS < tablaWidth) {
         posActual += 1;
         /* LINE 20 OF THE CODE ********************************************/ 
         leftCSS = moverTabla(posActual, cantCeldas, tdWidth); //moverTabla function (moveTable in english) returns the leftCSS value because it's needed on this function for the 'if'
     }
 });
 $('#leftArrow').click(function() {
     if(posActual > 0) {
         posActual -= 1;
         leftCSS = moverTabla(posActual, cantCeldas, tdWidth);
     }
 });

});

function moverTabla(pos, cantidad, tdWidth) {
 var leftCSS = pos * tdWidth;
 $('.imagenesWrapper table').animate( {left: '-' + leftCSS +'px'}, 'slow');
 mostrarOcultarFlechas(pos, cantidad);
 return leftCSS;
}

function mostrarOcultarFlechas(pos, cantidad) {
 //mostrar-ocultar flecha izquierda
 if(pos==0)
     $('#leftArrow').hide();
 else if($('#leftArrow').css('display') == 'none')
     $('#leftArrow').show();
 //mostrar-ocultar flecha derecha
 if(pos==cantidad)
     $('#rightArrow').hide();
 else if($('#rightArrow').css('display') == 'none')
     $('#rightArrow').show();
}

I have no clue what's going on. Would anyone be kind enough to provide some help, or clue?

Thanks a lot in advance

A: 

I see you're calculating a few values to get the leftCSS value. Is that always an integer? IE7 might not be happy if you're trying to animate it by doing animate using a decimal i.e. animate({left: 4.3102918px}). Just a thought. Consider rounding.

Marko
hey marko, it might have something to do with that. I'll take a look at it. Thanks for the idea.
sanchy
hey it's me again. That isn't it. <td> widths are 300px always, and <table> widths are always 300px * as many <td> there are.So the 'left' property it's always a multiple of 300.. 600, 900, 1200, 1500.HOWEVER, when animating, the left value does get decimal numbers. Any idea how to fix that? since i'm not having control over the values it applies to 'left' during the animation.
sanchy
A: 

OP here. Well, the problem is at the jQuery archive. I just downloaded the last one, uncompressed, and the line changed from 20 to 4619 character 4.

I went to that line and there's an '}' symbol LOL... did i mention i hate internet explorer?

sanchy
Please add comments or edit the original question rather than add notes as answers so that your updates do not get pushed down by other answers.
Mark Schultheiss
The line indicated isn't always the line in your js file. If I remember right it is the line and char in the rendered code. try disabeling every script and enabeling them one by one. check when it gives errors
Nealv
sry Mark, thanks for the comment.Nealv, okay, but still, the only file that could contain 4 thousand lines is the jquery.js that i just downloaded from jquery.comSo it's a bug.. i guess :S
sanchy