【发布时间】:2020-12-03 17:22:27
【问题描述】:
我正在尝试创建一个模式,但是当我在基本域中时它会打开,例如:
模态在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">×</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>
【问题讨论】:
-
你有没有检查过首页加载的脚本在购物车/索引中是否相同。您还可以在购物车/索引中发布您如何触发此模式吗?谢谢
-
{literal}<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>{/literal} -
@RicardoMartins 请使用您在评论中添加的 javascript 代码编辑您的帖子。
-
我已经用脚本更新了
-
检查所有源文件,如引导 css 和 js 文件以及 jquery。我认为您的 cuuent 页面中缺少这些文件。或者您可以在控制台中检查错误,然后进行相应操作。
标签: html css codeigniter modal-dialog