Giter Site home page Giter Site logo

iframe-shim's People

Contributors

afc163 avatar bitdeli-chef avatar leoner avatar lepture avatar lifesinger avatar lizzie avatar popomore avatar sorrycc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iframe-shim's Issues

z-index 的问题

如果 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,其他浏览器正常

http://doc.chuo.me/demo/z-index.html

某些场景无法遮挡

如果页面上有 DOM 设置了 z-index,那么现在的 iframe 就无法盖住这个 DOM。

尝试去获取 target 的 z-index,可以通过这个值去设置 iframe 的 z-index。

调整 iframe-shim 的接口

调整为工具类的接口

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.