我有以下JavaScript 关
@section('javascript')
@parent
<script src="https://cdnjs.cloudflare.com/ajax/libs/jsrender/0.9.91/jsrender.min.js"></script>
<script>
function roundToTwo(num) {
return + (Math.round(num + "e+2") + "e-2");
}
$(".pl-coord-link-button").on("click", function() {
$("#pl-modal-map-content").html(
$.templates("#pl-map-template").render({
bbox1: roundToTwo($(this).data('lon') - 0.02),
bbox2: roundToTwo($(this).data('lat') - 0.02),
bbox3: roundToTwo($(this).data('lon') + 0.02),
bbox4: roundToTwo($(this).data('lat') + 0.02),
lat: $(this).data('lat'),
lon: $(this).data('lon')
})
)
})
</script>
<script id="pl-map-template" type="text/x-jsrender">
<div class="embed-responsive embed-responsive-4by3 border">
<iframe class="embed-responsive-item" scrolling="no" src="http://www.openstreetmap.org/export/embed.html?bbox=@{{:bbox1}}%2C@{{:bbox2}}%2C@{{:bbox3}}%2C@{{:bbox4}}&marker=@{{:lat}}%2C@{{:lon}}&layer=mapnik"></iframe>
</div>
<div class="py-2 text-muted pl-coordinates">
<a target="_blank" href="https://www.openstreetmap.org/?mlat=@{{:lat}}&mlon=@{{:lon}}#map=5/@{{:lat}}/@{{:lon}}" class="pl-coord-link"><i class="fas fa-globe-americas" aria-hidden="true"></i>@{{:lat}}° @{{:lon}}°</a>
</div>
</script>
@endsection
当我打开控制台时,地图会按预期放大,但是当我关闭它时,地图会一直缩小
我不知道打开控制台会如何改变任何东西,我想也许是因为它使窗口变小了,但是我调整了窗口的大小却仍然不起作用?
打开控制台后会发生什么变化?
更新:在Chrome开发人员中进行测试且一切正常,必须是特定于FireFox的错误