【发布时间】:2014-10-22 13:29:51
【问题描述】:
为什么 jQuery 和 Bootstrap 可以在 Firefox 中运行,但是当我在 IE 中打开同一个页面时却没有任何效果???呃,谁能解释一下当这种情况发生时你必须做什么?您必须为每个浏览器编写单独的代码吗?我什至不知道从哪里开始它如何在一个浏览器中工作,而在另一个浏览器中却不行!?
此示例适用于 Firefox,但不适用于 IE
<select name="SPECIAL" id="SPECIAL">
<option>Please Select</option>
<option data-name="Animal Friend" data-img="/images/img/AnimalFriend.png" data-price="$30" value="1">Animal Friend</option>
<option data-name="Aquaculture" data-img="/images/img/Aquaculture.png" data-price="$30" value="2">Aquaculture</option>
<option data-name="Protect Our Oceans" data-img="/images/img/ProtectOurOceans.png" data-price="$30" value="3">Protect Our Oceans</option>
<option data-name="Conserve Wildlife" data-img="/images/img/ConserveWildlife.png" data-price="$30" value="4">Conserve Wildlife</option>
</select>
<!-- Modal -->
<div class="modal fade" id="modal_special" 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"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Specialty Plate</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary accept">Accept</button>
</div>
</div>
</div>
</div>
$(function() {
$('#SPECIAL').on('change', function() {
if ($('option:selected', this).is('[data-img]')) {
$('#modal_special').find('.modal-body').html('<p>Image will go here:</p>')
.append('<img alt="coming soon" src="' + $('option:selected', this).data('img') + '"/>')
.end().modal('show');
}
});
$('.accept').on('click',function() {
//do something
$('#modal_special').modal('hide');
});
});
【问题讨论】:
-
Bootstrap 和 IE 哪个版本?
-
您需要发布您的代码。我们无法读懂你的想法。
-
你确定你是在边缘模式而不是怪癖模式下运行 IE 吗?
-
@Bauer 您的标记无效。我的意思是,
<option>Please Select</div>,认真的吗?
标签: jquery twitter-bootstrap internet-explorer firefox