zoukankan      html  css  js  c++  java
  • BootStrap如何支持多模态框弹窗

    	$(document).on('show.bs.modal', '.modal', function(event) {
            $(this).appendTo($('body'));
        }).on('shown.bs.modal', '.modal.in', function(event) {
            setModalsAndBackdropsOrder();
        }).on('hidden.bs.modal', '.modal', function(event) {
            setModalsAndBackdropsOrder();
        });
    
    
        function setModalsAndBackdropsOrder() {  
            var modalZIndex = 1040;
            $('.modal.in').each(function(index) {
                var $modal = $(this);
                modalZIndex++;
                $modal.css('zIndex', modalZIndex);
                $modal.next('.modal-backdrop.in').addClass('hidden').css('zIndex', modalZIndex - 1);
            });
            $('.modal.in:visible:last').focus().next('.modal-backdrop.in').removeClass('hidden');
        }

    该操作的可能后果:

    对应的model将会被移动到body外创建,一旦页面使用单页面技术框架类似于AngularJs相关的话,将会造成路由再次跳回的时候,model重复加载。不太建议直接这样实现。

    若多Model弹窗的话 还有一种就是修改对应的层级model对应的z-index。

  • 相关阅读:
    HPA
    docker 入门
    idea手动保存文本
    mac下安装配置sql plus
    oracle序列
    oracle存储过程
    Java正则表达式
    expect命令
    关于OneDrive/GoogleDrive推送的定价方案征询
    存储设备故障已修复,及对用户的补偿措施
  • 原文地址:https://www.cnblogs.com/pigga/p/10098208.html
Copyright © 2011-2022 走看看