【发布时间】:2011-09-28 13:58:41
【问题描述】:
我有以下代码: 第一个函数使用 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);
});
});
});
【问题讨论】:
标签: jquery append jquery-hover