模态不要在 codeigniter 中打开

modal dont open in codeigniter

我正在尝试创建模态框,但当我在基本域中时它会打开,例如:

模式在 www.example.com

中打开

但未在

中打开

www.example.com/index.php/cart/index 我不知道为什么

    <div id="myModal" class="modal fade">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4>Select your language</h4>                       
            </div>
            <!--<section>-->
                <div class="modal-body">
                    <div class="col-md-4">
                    <a href="https://www.w3schools.com"><img width=128px height=128px src="https://image.flaticon.com/icons/png/128/323/323329.png" alt="" class="img-responsive none" style='object-fit: contain'/></a>
                    <p>English</p>
                    </div>
                    <div class="col-md-4">
                        <img width=128px height=128px src="https://image.flaticon.com/icons/png/128/323/323329.png" alt="" class="img-responsive none" style='object-fit: contain'/>
                        <p>English</p>
                        </div>
                        <div class="col-md-4">
                            <img width=128px height=128px src="https://image.flaticon.com/icons/png/128/323/323329.png" alt="" class="img-responsive none" style='object-fit: contain'/>
                            <p>English</p>
                            </div>
                <div class="tab_img">
                    
                        <div class="container" style='height: 100%; width: 100%; object-fit: contain'>
                                
                                <div class="overlay">
                                </div>
                            </a>    
                        </div>
                    </div>
                    </div>
                </div>
            
            <!--</section>-->
        </div>
        </div>
    </div>
    </div>

激活模态的脚本

<script type="text/javascript">
    jQuery(document).ready(function($) {
        $(".scroll").click(function(event){     
            event.preventDefault();
    
    
    $('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
        });
    });
</script>{/literal}
{literal}<script>
$(document).ready(function(){
    $("#myModal").modal('show');
});
</script>

你检查过 Routes.php 了吗?

$routes->get('/', 'Cart::index');

希望这能解决您的问题。

尝试在 config.php 中检查您的 base_url()。 问题可能是您没有正确加载 css。