我有下面的代码:第一个函数使用 rel 属性在鼠标悬停时显示替代图像 第二个函数采用隐藏的 div 并在同一页面上的另一个位置显示内容但是当我悬停图像时图像不会改变,隐藏 div 上的悬停有效,但在单击其他位置移动它后,悬停不起作用。我认为这可能是文档准备脚本,因为我在准备好后更改了页面,但我不确定,有什么建议吗?谢谢你
$(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);
});
});
});