简体   繁体   English

Magento 2 模态 z-index

[英]Magento 2 modal z-index

Is there a way to change the magento2 modal ( & modal overlay ) z-index, using their built in modal widget?有没有办法改变 magento2 modal ( & modal overlay ) z-index,使用他们内置的 modal 小部件?

I've read all their docs and I couldn't find a nice way of doing it.我已经阅读了他们所有的文档,但找不到一个很好的方法。 But I do really need to increase the z-index...但我确实需要增加 z-index ......

I would rather change z-index for specific modals, but a global override of all modal widget z-index's would be OK too.我宁愿更改特定模态的 z-index,但是全局覆盖所有模态小部件 z-index 也可以。

Here is the relevant part of my code ('zIndex' doesn't do anything)这是我的代码的相关部分('zIndex' 不做任何事情)

Any ideas..?有任何想法吗..?

var options = {
  type: 'popup',
  clickableOverlay: true,
  zIndex: 9995 
};
var modalPopup = modal(options, $('#modal_id'));
$('#modal_el').click(function() { modalPopup.openModal() });

Cheers!干杯! :) :)

Fixed using css!修复使用css!

Set a custom class on the modal and set the z-index on this在 modal 上设置自定义类并在此设置 z-index

var options = {
  ...
  modalClass: 'hi_z_index'
};

In my case editing a css class didnt resolve my issue and I find solution in adding a zIndex for modal form after init it.在我的情况下,编辑 css 类并没有解决我的问题,我找到了在初始化后为模态表单添加 zIndex 的解决方案。 So you can after it所以你可以在它之后

var modalPopup = modal(options, $('#modal_id'));

add this添加这个

modalPopup.modal.zIndex(2000000001);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM