【问题标题】:Calling a function on bootstrap modal open - js additional code在引导模式打开时调用函数-js附加代码
【发布时间】:2020-11-24 12:02:20
【问题描述】:

它不是重复的问题,因为我不理解 smilar 问题的答案。如果答案很简单,我可以在解决我的问题后删除。

当 bootstrap 3 modal 打开时,我的巨型菜单出现在它上面。为了解决这个问题,当 bootstrap modals 打开时,我必须减少巨型菜单的 z-index。mega 菜单的 z-index 现在一直是最大的。

我发现了这个问题:

Calling a function on bootstrap modal open

上面写着:

$('#code').on('shown.bs.modal', function (e) {
  // do something...
})

用于引导程序 3。

如何使用 jquery 或 javasicript 编写此代码?

编辑:为了给出具体要求,我想确定引导类以使用它而不是#code word,然后通过 jquery 编写更改特定类的 z-index 值。

https://resimli.yedek.deniz-tasarim.site/

网站是这个。

bootstrap modals 打开,标题上带有注册/登录按钮。 (右上角)


我对 bootstap 3 很陌生,而且有很多模态类。所以,它让我很困惑。

【问题讨论】:

  • 你的问题不清楚。你能具体解释一下你想要达到的目标吗?!
  • @sergeykuznetsov 我编辑了 question.in 特殊的观点,“为了给出具体的要求,我想确定引导类来使用它而不是#code word,然后写一个特殊的 z-index 值通过 jquery 类。"
  • @sergeykuznetsov 你能再看看这个问题吗?
  • 嗨。是的,当然,只是稍晚一点。
  • 您的问题目前还相关吗?

标签: javascript jquery twitter-bootstrap


【解决方案1】:

由于默认最大值z-index,您的菜单与模式重叠。

现在菜单的 CSS 规则如下所示:

#wp-megamenu-header-menu {
    z-index: 9999; <=== /*the problem is here*/
    text-align: left;
    height: 90px;
    background-color: #fff;
    padding-top: 20px;
    padding-right: -20px;
    padding-bottom: 40px;
    padding-left: 0;
}

这很可能是你写的:

.wp-megamenu-wrap {
    z-index: 99999;
}

要解决这个问题,用!important 规则覆盖z-index 就足够了。将此规则插入您的 CSS:

#wp-megamenu-header-menu {
    z-index: 1000!important;
}

你的重叠问题就会消失!

【讨论】:

    猜你喜欢
    • 2013-07-01
    • 2018-06-05
    • 2013-03-02
    • 1970-01-01
    • 2020-10-25
    • 2015-11-23
    • 2014-09-06
    • 1970-01-01
    • 2019-01-01
    相关资源
    最近更新 更多