Twitter bootstrap 引导开关非常长
结果是: 我的代码:Twitter bootstrap 引导开关非常长,twitter-bootstrap,bootstrap-switch,Twitter Bootstrap,Bootstrap Switch,结果是: 我的代码: <html lang="en"> <head> <% include partials/template/head.ejs %> <% include partials/template/jsdefaults.ejs %> </head> <body class="<%= classname %>"> <% include partials/tem
<html lang="en">
<head>
<% include partials/template/head.ejs %>
<% include partials/template/jsdefaults.ejs %>
</head>
<body class="<%= classname %>">
<% include partials/template/header.ejs %>
<% var prodPhotoString = "/images/products/" + product.mainImage %>
<% if (Boolean(product.camp.mainImage)) { var campPhotoString = "/images/camps/" + product.camp.mainImage } else { var campPhotoString = "/images/defaults/camp.jpg"}%>
<% var costPerHr = product.cost/product.contactHours %>
<div class="container">
<div class="row">
<div class="col-sm-1">
</div>
<div class="col-sm-7">
<h2><%= product.name %></h2>
<div class='prodImage' style="float:right;">
<img src="<%= prodPhotoString %>" class="img-thumbnail" width="300"/>
</div>
<h3>Price</h3>
<h4><strong>Cost:</strong> €<%= product.cost %> per place</h4>
<h4><strong>Activity Time:</strong> <%= product.contactHours %> hrs</h4>
<h4><strong>Cost per Activty Hour:</strong> <%= costPerHr.toFixed(2) %> €/hr</h4>
<h3>Dates</h3>
<h4><strong>Begins:</strong> <%= moment(product.startDate).format('MMM Do YYYY hh:mm') %></h4>
<h4><strong>Finishes:</strong> <%= moment(product.endDate).format('MMM Do YYYY hh:mm') %></h4>
<h3>Location</h3>
<h4>Toggle Map</h4>
<div class="make-switch switch-on">
<label class="sr-only" for="locSwitch">Map Toggle</label>
<input id="locSwitch" class="bootSwitch" type="checkbox" name="locSwitch" data-off-text="hide" data-on-text="show"></input>
</div>
<div style="display:none" id="map" class="embed-responsive embed-responsive-16by9">Map should be here, something broke...</div>
<h3>Places</h3>
<h4><strong>Capacity:</strong> <%= product.places.max %> people</h4>
<h4><strong>For:</strong> <%= product.ages.min %> - <%= product.ages.max %> years old</h4>
<h4><strong>Capacity:</strong> <%= product.places.max %> people</h4>
<p><%= product.description %></p>
</div>
<div class="col-sm-4">
<a href="#"><h3><%= product.camp.name %></h3></a>
<div class='campImage' style="float:right;">
<img src="<%= campPhotoString %>" class="img-thumbnail" width="120"/>
</div>
<p>
<strong>Camp Rating: </strong> <%= product.camp.stars %> stars<br>
<strong>Address: </strong> <%= product.camp.location.address.line1 %>, <%= product.camp.location.address.line2 %>, <%= product.camp.location.address.county %> <br>
<strong>Description: </strong> <%= product.camp.about %>
</p>
</div>
</div> <!--row-->
</div> <!--container-->
<% include partials/template/footer.ejs %>
<% var googurl = "https://maps.googleapis.com/maps/api/js?key=" + googapi.key %>
<script type="text/javascript" src="<%= googurl %>"></script>
<script>
$(document).ready(function () {
$(".bootSwitch").bootstrapSwitch();
$('#locSwitch').on('switchChange.bootstrapSwitch',function (event, state){
$('#map').toggle()
initMap()
})
// MAP
function initMap() {
var myLatLng = {lat: Number(<%- JSON.stringify(product.meetLocation.loc[0]) %>), lng: Number(<%- JSON.stringify(product.meetLocation.loc[1]) %>)}
map = new google.maps.Map(document.getElementById('map'), {
center: myLatLng,
zoom: 8
});
MeetMarker = new google.maps.Marker({
position: myLatLng,
map: map,
title: "My Meeting Point",
dragable: false
})
<% if (Boolean(product.finishLocation.address.county)) { console.log(product.finishLocation.address.county) %>
FinMarker = new google.maps.Marker({
position: {lat: Number(<%- JSON.stringify(product.finishLocation.loc[0]) %>), lng: Number(<%- JSON.stringify(product.finishLocation.loc[1]) %>)},
map: map,
title: "My Meeting Point",
dragable: false
})
<% } %>
}
})
</script>
</body>
</html>
“class=“img缩略图”width=“300”/>
价格
成本:每处
活动时间:小时
每小时活动成本:€/hr
日期
开始:
饰面:
位置
切换贴图
贴图切换
地图应该在这里,有东西坏了。。。
地点
能力:人
适用于:-岁
能力:人
“class=“img缩略图”width=“120”/>
营地评级:明星
地址:,
说明:
$(文档).ready(函数(){
$(“.bootSwitch”).bootstrapSwitch();
$('#locSwitch').on('switchChange.bootstrapSwitch',函数(事件、状态){
$('#map').toggle()
initMap()
})
//地图
函数initMap(){
var myLatLng={lat:Number(),lng:Number()}
map=new google.maps.map(document.getElementById('map'){
中心:myLatLng,
缩放:8
});
MeetMarker=new google.maps.Marker({
职位:myLatLng,
地图:地图,
标题:“我的汇合点”,
可拖动:错误
})
FinMarker=new google.maps.Marker({
位置:{lat:Number(),lng:Number()},
地图:地图,
标题:“我的汇合点”,
可拖动:错误
})
}
})
引导开关功能完美,但我不知道为什么它这么长。我已尝试更改属性data size=“small”
,但它仍然不会更改开关的长度。我还试着去掉类makeswitch
和switch-on
,但长度没有变化。
知道为什么会这样吗
编辑:我可以设置给开关
以下内容;
但这是一个肮脏的解决办法。它看起来也不太好。我认为您没有关闭第一行('col-sm-1'),然后没有创建下一行(''),我不确定,因为我无法重现您面临的行为。如果你能做一把小提琴会有帮助的。谢谢你的回复,但我不明白。我所有的
都已关闭。我试着制作一个JSFIDLE,但是有太多的依赖项存储在本地,这需要很长时间才能开始工作。你是否已经尝试不将复选框放在他自己的复选框中?是的,我将复选框放在了它自己的
,但没有帮助。在我看来,如果所有div都关闭,可能是css问题。你可以检查谷歌浏览器中的元素,看看这是否能给你一些启示