简体   繁体   English

Bootstrap 模态框在 AEM 中消失

[英]Bootstrap modal box is disappearing in AEM

This is my html code for bootstrap modal.这是我用于引导模式的 html 代码。 Its working as expected in my local browser but when I am running in AEM, the modal box comes for a second and disappears.它在我的本地浏览器中按预期工作,但是当我在 AEM 中运行时,模式框会出现一秒钟然后消失。 I read many answers on stackoveflow but none of them worked for AEM.我在 stackoveflow 上阅读了很多答案,但没有一个适用于 AEM。 Has anyone else experienced this issue?有没有其他人遇到过这个问题?

 <div class="wrapper"> <button type="button" id="modalButton" class="btn btn-primary" data-toggle="modal" data-target="#myModal" onclick="javascript: return false;" > Click me </button> </div> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> </div> <div class="modal-body"></div> </div> </div> </div>

I fixed the issue, the data-toggle was not working我解决了这个问题,数据切换不起作用

Added the open function here:在此处添加了打开的 function:

<a type="button" id="modalButton" class="btn btn-primary" data-target="#myModal"  onclick="showmodal ();" >
            Click me
        </a>

And the close function here:并且在这里关闭 function:

<button type="button" class="close" onclick="hidemodal ()">&times;</button>

Added these two within the script tag


function showmodal () {
            $("#myModal").show();
        }
        function hidemodal () {
            $("#myModal").hide();
        }

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

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