我找到并修改了一种创建文本到图像翻转的好方法,在这里:http://jsfiddle.net/pkZAW/12/
$( function() {
$("#imglink").hover(
function () {
$(this).attr('small',$(this).html());
$(this).html($(this).attr('full'));
},
function () {
$(this).html($(this).attr('small'));
}
);
});
但是,我需要淡入淡出的过渡,就像此处缩略图上的那样: http://lydiafraserward.co.uk/index.php?page=producing
经过多次搜索后,我无法将此转换添加到脚本中:-? ..有什么想法吗..?
最佳答案
我认为这种情况不需要 live() 。我不会在 mouseleave 函数上使用淡出,因为动画会叠加。
你也可以尝试这个:
$( function() {
$("#imglink").hover(
function () {
$(this).attr('small',$(this).html());
$(this).stop(false,true).fadeOut(250,function() {
$(this).html($(this).attr('full'));
$(this).stop(false,true).fadeIn(250);
});
}, function () {
$(this).html($(this).attr('small'));
});
});
编辑:使用 anchor 标记周围的跨度标记来修复闪烁效果:演示:http://jsfiddle.net/LYjvp/1/
关于jquery - 文本到图像翻转并淡入/淡出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13400389/