V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
mt1992
V2EX  ›  JavaScript

一个解决了点击 iframe 无法触发 mouse 事件的库

  •  
  •   mt1992 · 2018-04-12 23:41:25 +08:00 · 3665 次点击
    这是一个创建于 2177 天前的主题,其中的信息可能已经有所发展或是发生改变。

    众所周知,iframe 元素只能触发 load 事件。想想一下:在一个内嵌 iframe 的系统中导航栏中有 dropdown select 等组件,这些组件都有一个共性通过监听 click 或 mouseup 等事件来关闭弹出层,而 iframe 无法触发 mouse 事件,导致点击 iframe 区域的时候无法关闭弹出层,所以做一个库解决了这个问题。

    测试地址: https://jsfiddle.net/MT/eywraw8t/25950/

    github 仓库: https://github.com/1969290646/focus-outside

    cdn 地址: https://unpkg.com/[email protected]/lib/index.js

    ^_^ 既然都已经来了,就留下 star 呗。

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5346 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 932ms · UTC 08:24 · PVG 16:24 · LAX 01:24 · JFK 04:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.