你好 在jQuery中,我们可以使用下面的代码来使图像变暗.相反,我们怎样才能使图像变亮? $(this).hover(function() { $(this).stop().animate({ opacity: 0.5 }, 500);},function() { $(this).stop().animate({ opacity: 1.
在jQuery中,我们可以使用下面的代码来使图像变暗.相反,我们怎样才能使图像变亮?
$(this).hover(function() {
$(this).stop().animate({ opacity: 0.5 }, 500);
},
function() {
$(this).stop().animate({ opacity: 1.0 }, 500);
});
我会用
Pixastic.如果你想采取这条路线它有
jQuery bindings.
你可以像这样lighten or darken an image:
var img = new Image();
img.onload = function() {
Pixastic.process(img, "lighten", {amount:0.5});
}
document.body.appendChild(img);
img.src = "myimage.jpg";
您可以通过更改图像的不透明度来伪造此效果,确保图像背后的背景为白色.
