Bootstrap 模式在某些设备上无法打开
Bootstrap modal doesn't open on some devices
我想通过单击按钮打开 Bootstrap 模式。我无法在我的浏览器和某些 Galaxy 设备上运行,但无法在 Iphone 和我的 Galaxy A70 上运行。 (我朋友也用A70试过,效果很好!!!)
我真的不知道发生了什么,因为它以前有效,现在我只是更改了模态内容。
此外,当我在我的 JS 代码上的这个函数-$("#exampleModalCenter").on("show.bs.modal") 中编写一个警报时,警报会显示在我的设备中。
如果有人能帮助我,我将不胜感激!
我的HTML触发模态的代码:
<button type="button" style="font-size: medium ;" class="btn btn-outline-primary btn-sm btn-block container-non-responsive" data-toggle="modal" data-target="#exampleModalCenter" data-title="T-shirt" data-tag="3">
<b>choose</b>
</button>
</p>
我的模态:
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content" style="margin-right: 15px;">
<div class="modal-header " dir="rtl">
<h5 class="modal-title " id="exampleModalCenterTitle" dir="rtl"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="margin-right: 65px;">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="col-md-4 mb-3 ">
<table class="table table-borderless table-sm">
<tr>
<td>
<div class="btn-group dropdown " dir="rtl">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownQuantity" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button>
<div class="dropdown-menu quantites" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
<td>
<div class="dropdown ">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownSize" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dir="rtl">
</button>
<div class="dropdown-menu sizes" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
<td>
<div class="dropdown ">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownColor" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dir="rtl">
</button>
<div class="dropdown-menu color" aria-labelledby="dropdownMenu2" id="colorDiv">
</div>
</div>
</td>
</tr>
<tr id="americanTr">
<td></td>
<td></td>
<td>
<div class="dropdown " id="americanChoseSleeveDD">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownSleeveColor" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dir="rtl">
</button>
<div class="dropdown-menu Sleevecolor" aria-labelledby="dropdownMenu2" id="sleeveColorDiv">
</div>
</div>
</td>
</tr>
</table>
<table class="table table-borderless table-sm">
<tr>
<td>
<div class="btn-group dropdown " dir="rtl">
<button class="btn btn-outline-primary dropdown-toggle " type="button" id="dropDownSchool" style="margin-left: 40px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left school" id="schoolDiv" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
<td>
<div class="btn-group dropdown " dir="rtl">
<button class="btn btn-outline-primary dropdown-toggle " type="button" id="dropDownLocation" style="margin-right: 10px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left location" id="cityDiv" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
</tr>
</table>
<div class="col-md-6 mb-3" dir="rtl" id="schoolNameElseDiv">
<label for="schoolName" style="float: right;">else</label>
<input type="text" class="form-control" name="schoolName" id="schoolNameElseInput" placeholder="add your school name" value="" required>
<div class="invalid-feedback d-block" style="text-align: right;">
required
</div>
</div>
</div>
</div>
</div>
<table class="table table-borderless table-sm" id="symbols" style="max-width: 100%;">
<tr id=symbolsPlace>
</tr>
</table>
<p class="mb-1 text-muted text-center text-small">
<a href=" #0" onclick="openSizeRuler()">open size ruler</a> </p>
<div class="modal-footer" dir="rtl">
<div class="container">
<div class="row">
<div class="col text-center">
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="required">
<button type="button" disabled onclick="addToCartClick()" class="btn btn-outline-secondary " id="addToCart" style="pointer-events: none;"> add <i class="fas fa-shopping-basket"></i></button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
OpenSizeRuler函数在里面打开另一个模态。
希望大家帮帮我
更新:
我发现了问题,但我不知道如何面对它:
在模式中我有一个下拉菜单,它的值取自另一个 class。当我在生成下拉菜单的函数中创建 class 的实例时,模态停止工作并且不显示。
我使用的方式class:
function generateCityDD() {
var citiy = new Schools();
var cityArr = citiy.getCitiesArr();
appendToDropDown(cityArr, "cityDiv");
$(".location button").click(function() {
$("#dropDownLocation").text($(this).text());
selectLocation = $(this).text();
$("#dropDownSchool").text("choose a school");
selectSchool = null;
validate();
generateSchoolsDD();
});
}
有什么想法吗?
几小时后我想通了-
class 构造函数有问题:)
我想通过单击按钮打开 Bootstrap 模式。我无法在我的浏览器和某些 Galaxy 设备上运行,但无法在 Iphone 和我的 Galaxy A70 上运行。 (我朋友也用A70试过,效果很好!!!)
我真的不知道发生了什么,因为它以前有效,现在我只是更改了模态内容。
此外,当我在我的 JS 代码上的这个函数-$("#exampleModalCenter").on("show.bs.modal") 中编写一个警报时,警报会显示在我的设备中。
如果有人能帮助我,我将不胜感激!
我的HTML触发模态的代码:
<button type="button" style="font-size: medium ;" class="btn btn-outline-primary btn-sm btn-block container-non-responsive" data-toggle="modal" data-target="#exampleModalCenter" data-title="T-shirt" data-tag="3">
<b>choose</b>
</button>
</p>
我的模态:
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content" style="margin-right: 15px;">
<div class="modal-header " dir="rtl">
<h5 class="modal-title " id="exampleModalCenterTitle" dir="rtl"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true" style="margin-right: 65px;">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-row">
<div class="col-md-4 mb-3 ">
<table class="table table-borderless table-sm">
<tr>
<td>
<div class="btn-group dropdown " dir="rtl">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownQuantity" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button>
<div class="dropdown-menu quantites" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
<td>
<div class="dropdown ">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownSize" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dir="rtl">
</button>
<div class="dropdown-menu sizes" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
<td>
<div class="dropdown ">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownColor" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dir="rtl">
</button>
<div class="dropdown-menu color" aria-labelledby="dropdownMenu2" id="colorDiv">
</div>
</div>
</td>
</tr>
<tr id="americanTr">
<td></td>
<td></td>
<td>
<div class="dropdown " id="americanChoseSleeveDD">
<button class="btn btn-default dropdown-toggle" type="button" id="dropDownSleeveColor" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" dir="rtl">
</button>
<div class="dropdown-menu Sleevecolor" aria-labelledby="dropdownMenu2" id="sleeveColorDiv">
</div>
</div>
</td>
</tr>
</table>
<table class="table table-borderless table-sm">
<tr>
<td>
<div class="btn-group dropdown " dir="rtl">
<button class="btn btn-outline-primary dropdown-toggle " type="button" id="dropDownSchool" style="margin-left: 40px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left school" id="schoolDiv" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
<td>
<div class="btn-group dropdown " dir="rtl">
<button class="btn btn-outline-primary dropdown-toggle " type="button" id="dropDownLocation" style="margin-right: 10px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
</button>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-lg-left location" id="cityDiv" aria-labelledby="dropdownMenu2">
</div>
</div>
</td>
</tr>
</table>
<div class="col-md-6 mb-3" dir="rtl" id="schoolNameElseDiv">
<label for="schoolName" style="float: right;">else</label>
<input type="text" class="form-control" name="schoolName" id="schoolNameElseInput" placeholder="add your school name" value="" required>
<div class="invalid-feedback d-block" style="text-align: right;">
required
</div>
</div>
</div>
</div>
</div>
<table class="table table-borderless table-sm" id="symbols" style="max-width: 100%;">
<tr id=symbolsPlace>
</tr>
</table>
<p class="mb-1 text-muted text-center text-small">
<a href=" #0" onclick="openSizeRuler()">open size ruler</a> </p>
<div class="modal-footer" dir="rtl">
<div class="container">
<div class="row">
<div class="col text-center">
<span class="d-inline-block" tabindex="0" data-toggle="tooltip" title="required">
<button type="button" disabled onclick="addToCartClick()" class="btn btn-outline-secondary " id="addToCart" style="pointer-events: none;"> add <i class="fas fa-shopping-basket"></i></button>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
OpenSizeRuler函数在里面打开另一个模态。
希望大家帮帮我
更新:
我发现了问题,但我不知道如何面对它:
在模式中我有一个下拉菜单,它的值取自另一个 class。当我在生成下拉菜单的函数中创建 class 的实例时,模态停止工作并且不显示。
我使用的方式class:
function generateCityDD() {
var citiy = new Schools();
var cityArr = citiy.getCitiesArr();
appendToDropDown(cityArr, "cityDiv");
$(".location button").click(function() {
$("#dropDownLocation").text($(this).text());
selectLocation = $(this).text();
$("#dropDownSchool").text("choose a school");
selectSchool = null;
validate();
generateSchoolsDD();
});
}
有什么想法吗?
几小时后我想通了- class 构造函数有问题:)