开发者

jQuery, IE and invalid argument

EDIT:

OP here. Well, the problem is at the jQuer开发者_JS百科y.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


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜