0
我有下面的代码: 第一个功能显示鼠标替代图像使用reltribute 第二个功能需要一个隐藏的div和显示内容在另一个地方在相同页面,但是当我将图像悬停在图像上时,图像不会改变,隐藏div上的悬停工作正常,但在其他位置点击后,悬停不起作用。我认为这可能是文档就绪脚本,因为我准备好后改变页面,但我不确定,有任何建议?谢谢jquery hover功能不工作后显示img
$(document).ready(function(){
$(function() {
$('img[rel]').hover(function() {
$(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('rel')).attr('rel', $(this).attr('tmp')).removeAttr('tmp');
}).each(function() {
$('<img />').attr('src', $(this).attr('rel'));
});;
});
$(function(){
$('.id2').one("click",function() {
var newPara = $('#test').html();
$('#big_photo').append(newPara);
});
});
});
我使用它在动态图像画廊,我不能使用精灵。精灵的想法很好,生病就会把它应用到别的东西上。谢谢 –
@DspMarian更新了我的答案 – Andy