jQuery、IE 和无效参数
编辑:
OP在这里。好吧,问题出在 jQuery.JS 存档上。我刚刚下载了最后一个,未压缩,错误更改为第 4619 行字符 4。
我转到该行,有一个“}”符号哈哈...我有没有提到我讨厌 Internet Explorer?
我不知道如何解决这个问题,这似乎是框架内的一个错误:S
/编辑
嗨,你好! -我讨厌 Internet Explorer :D-
我用 jQuery 制作了一张幻灯片来为一个小图像库制作动画。
http://www.imagina.com.uy/bentancorleborgne/?page_id=2< /a>
在 Firefox、Safari 和 IE8 上运行良好。
但是在 IE7 及更早版本上会出现错误。弹出一条消息:
脚本错误。
行:20
字符:31759
错误:参数无效
URL:http-://www-.imagina.com.uy/bentancorleborgne/?page_id=2
我在该页面上运行了几个脚本,但是由于当我尝试滑动画廊,我猜错误来自这段代码:
// 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();
}
我不知道发生了什么。有人愿意提供一些帮助或线索吗?
预先非常感谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我看到您正在计算一些值来获取 leftCSS 值。这总是一个整数吗?如果您尝试使用小数点进行动画制作,即
animate({left: 4.3102918px})
,IE7 可能会不高兴。只是一个想法。考虑四舍五入。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.在这里。好吧,问题出在 jQuery 存档上。我刚刚下载了最后一个,未压缩,该行从 20 更改为 4619 个字符 4。
我转到该行,有一个“}”符号哈哈...我有没有提到我讨厌 Internet Explorer?
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?