



























2014-09-22 16:13 Koy 阅读(4265) 评论() 收藏 举报
用JQUERY给IMG element绑定click事件的时候,直接用img.click(function(){...})不起作用,如下面代码
$("img.ms-rteImage-LightBox").click(function(){
SP.UI.ModalDialog.showModalDialog({
url: $(this).attr("src"),
title: $(this).attr("alt")
});
});
解决这个问题需要用jquery里面bind函数去附加click event. 如下:
$("img.ms-rteImage-LightBox").bind("click",function(){
SP.UI.ModalDialog.showModalDialog({
url: $(this).attr("src"),
title: $(this).attr("alt")
});
});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。