【发布时间】:2015-06-15 08:18:10
【问题描述】:
我正在使用 Bootstrap 进行开/关切换。在此页面中,它每 5 秒刷新一次 ajax 以重新加载页面内容。我面临的问题是当通过 ajax 刷新页面时,引导开关失去了它的 css 样式。
我使用 Firefox 检查,这就是我所看到的:
ajax 刷新前:
<div id="override">
.....
<div class="margin-bottom-10"> <label for="option1"></label> <div class="bootstrap-switch bootstrap-switch-wrapper bootstrap-switch-on bootstrap-switch-small bootstrap-switch-animate bootstrap-switch-id-1234>
<div class="botstrap-switch-container">
<span class="bootstrap-switch-handle-on bootstrap-switch-primary">On</span>
<label class="bootstrap-switch-label" for="1234"></label>
<span class="bootstrap-switch-handle-off bootstrap-switch-default">Off</span>
<input id="1234" name="radio1" class="make-switch" data-size="small" checked="" type="checkbox">
</div>
</div>
</div>
......
</div>
ajax 刷新后:
<div id="override">
.....
<div class="margin-bottom-10">
<label for="option1"></label>
<input id="1234" name="radio1" class="make-switch" data-size="small" checked="" type="checkbox">
</div>
..........
</div>
ajax 代码:
$.get(url, function(data) {
$("#override").html(data);
}
我如何重新加载那些必要的引导 css 甚至 js ??
【问题讨论】:
标签: twitter-bootstrap bootstrap-switch