惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
S
SegmentFault 最新的问题
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
DataBreaches.Net
F
Fortinet All Blogs
TaoSecurity Blog
TaoSecurity Blog
D
Docker
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
宝玉的分享
宝玉的分享
腾讯CDC
Google Online Security Blog
Google Online Security Blog
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
T
The Blog of Author Tim Ferriss
V
V2EX
S
Securelist
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
Y
Y Combinator Blog
P
Proofpoint News Feed
T
Tor Project blog
AWS News Blog
AWS News Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
博客园 - 聂微东
T
Threat Research - Cisco Blogs
B
Blog
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
C
CXSECURITY Database RSS Feed - CXSecurity.com
阮一峰的网络日志
阮一峰的网络日志
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
IT之家
IT之家
N
News and Events Feed by Topic
博客园 - 司徒正美
H
Help Net Security
C
Cisco Blogs
C
Check Point Blog
S
Secure Thoughts

博客园 - Koy

vbox 安装 MacOS 时遇到的问题 转载:登录后,用户配置被修改的处理方法 left join 和 inner join 区别和优化 认识位移操作符 動態修改 XML 欄位 (轉載)sql server xml字段的操作 (轉)CSS 单行溢出文本显示省略号...的方法(兼容IE FF) (轉)Equal height boxes with CSS 獲得瀏覽器顯示標簽的真實的長寬高 SqlLocalDB 的一些常用命令行 转:css实现强制不换行/自动换行/强制换行 終于解決调用wordpress 4.3 xmlrpc api 发布包含分类的文章时返回“抱歉,文章类型不支持您的分类法”错误的問題 SQL 數字欄位格式調整(輸出結果以0補至固定長度) 转载:数组Marshalling ajax 維護 div 的 scrollbar 每日构建的好工具 修正了Flex Tree 控件在動態加載節點后 Scrollbar 沒有立即出現的問題 根據基本目錄及文件的全路逕,創建相應的子目錄,爲保存文件作準備 - Koy - 博客园 轉載:Sqlserver 2005 利用 with 創建臨時表進行遞歸查詢
轉:Jquery绑定img的click事件
Koy · 2014-09-22 · via 博客园 - Koy

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") 
    }); 
});