【发布时间】:2012-05-06 08:48:07
【问题描述】:
我正在将图像加载到 div 中,然后对新加载的图像启动轮播。一切正常,除了我无法获取脚本来获取图像的宽度并进行设置。
这是我目前拥有的...
获取图片大小函数
function imgSize() {
$('img').each(function() {
var imgWidth = $(this).width();
var imgHeight = $(this).height();
$(this).attr('height', imgHeight);
$(this).attr('width', imgWidth);
});
}
加载新页面、调用图片大小函数、轮播函数
$('.menu a').live('click', function() {
var id = $(this).attr('id');
var page = id + '.html'
$('#portfolio').load( page , function() {
imgSize();
$('#portfolio').carouFredSel(settings);
$('#bodyFooter span').show();
});
});
您可以在此处看到一个示例:http://www.amandarecker.com/siteTest 当您单击“美”时,所有图像都会相互叠加,或者甚至不显示。当我用 firebug 查看源代码时,宽度设置为 0。为什么?
希望有人可以帮助...谢谢
【问题讨论】: