aralejs / iframe-shim Goto Github PK
View Code? Open in Web Editor NEWIframe-Shim Utility
Home Page: aralejs.org/iframe-shim
Iframe-Shim Utility
Home Page: aralejs.org/iframe-shim
如果 target 的父级元素设置了 position 而未设 z-index,那么 iframe 的高度永远高于 target
<div style="position:relative;">
1
<div style="position:absolute;z-index:2;">
2
</div>
</div>
<div style="position:relative;z-index:1;">
3
</div>
在 IE6,7 3 高于 2,其他浏览器正常
如果页面上有 DOM 设置了 z-index,那么现在的 iframe 就无法盖住这个 DOM。
尝试去获取 target 的 z-index,可以通过这个值去设置 iframe 的 z-index。
调整为工具类的接口
shim = iframeShim('#target');
shim.sync();
shim.destroy();
如果传入的对象有 show 和 hide 方法,可不调用 sync
var obj = {
element: '#target',
show: function(){},
hide: function(){}
};
iframeShim(obj);
obj.show(); // 显示 iframe
obj.hide(); // 隐藏 iframe
可直接操作绑定实例,这样不需要在组件内部集成
var popup = new Popup();
iframeShim(popup);
new Shim().sync().sync();
Noop 未 return this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.