实时 HTML5 灰度
我需要将此脚本用于网站画廊: http://webdesignerwall.com/tutorials /html5-grayscale-image-hover/
这对于已加载的图像非常有用:
$(window).load(function(){
$('.item img').each(function(){
this.src = grayscale(this.src);
});
});
function grayscale(src){ //blabla };
问题是我使用 ajax 加载下一个图像,并且效果不会应用于新的 ajax 元素。
谢谢你!
如果我成功加载函数,效果将覆盖现有的灰色图像!
I need to use this script for a website gallery: http://webdesignerwall.com/tutorials/html5-grayscale-image-hover/
This works great for images already loaded:
$(window).load(function(){
$('.item img').each(function(){
this.src = grayscale(this.src);
});
});
function grayscale(src){ //blabla };
The problem is that I load next images with ajax, and the effect is not applied to new ajax elements.
Thank you!
If I load my function on success, the effect will overwrite the existent grayed images!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 AJAX 成功回调时调用该方法:
call that method on success callback of the AJAX: