gpt4 book ai didi

javascript - jquery bootstrap 崩溃无法正常工作

转载 作者:行者123 更新时间:2023-11-28 03:03:06 25 4
gpt4 key购买 nike

我在元素 div class"collapse" 和 2 按钮中有内容:1. 折叠元素外更新数据的第一个按钮2. 折叠元素的第二个按钮+更新其他数据

我的问题: 1. 如果我打开页面,元素类 "collapse" 是隐藏的,当我点击第二个按钮时,显示折叠。然后我想更新第一个按钮中的数据,立即隐藏元素 "collapse"。但是为什么当我点击第一个按钮时,元素“collapse”显示出来了?尽管如此,第一个用于更新数据和隐藏元素的按钮崩溃了。第二个按钮显示折叠...

https://jsfiddle.net/e6ny483c/

我的页面:

<div class="grid fluid">
<div class="row ">
<div id="containerTanggal" class="col-sm-4 " >
Tanggal Monitoring:
<div class="input-control text" style="width: 150px">
<input type="text" name="tanggalMonitoring" id="tanggalMonitoring"/>
<span id="image_button_tanggalMonitoring" class="btn-date"></span>
</div>
</div>
<button class="large primary btnLoadMonitoring" type="submit" id="btnLoadMonitoring">Lihat Monitoring</button>
</div>

<!--overview hari ini-->
<div class="row">
<!--gauge bensin-->
<div class="col-md-3">
<section class="panel">
<div class="panel-body">
<div class="top-stats-panel">
<div class="gauge-canvas">
<div class="widget-h">Penggunaan Bahan Bakar Hari Ini</div>
<canvas width=160 height=100 id="bahanbakarHariIni"></canvas>
</div>
<ul class="gauge-meta clearfix">
<li id="gauge-textfield" class="pull-left gauge-value"></li>
<li class="pull-right gauge-title">Liter</li>
</ul>
</div>
</div>
</section>
</div>
<div class="col-md-3">
<section class="panel">
<div class="panel-body">
<div class="top-stats-panel">
<div class="daily-visit">
<div class="widget-h">Sampah Masuk Hari Ini</div>
<div class="mini-stat clearfix">
<div class="mini-stat-info" >
<span id="tonaseHariIni"></span>
</div>

</div>
<ul class="chart-meta clearfix">
<li class="pull-left visit-chart-value" id="selisihTonase"></li>
<li class="pull-right visit-chart-title" id="persentaseSelisihTonase"></li>
</ul>
</div>
</div>
</div>
</section>
</div>
<div class="col-md-3">
<section class="panel">
<div class="panel-body">
<div class="top-stats-panel">
<div class="widget-h">Jenis Angkutan Sampah</div>
<div id="pie-chart-donut" class="pie-chart">
<div id="pie-donutContainer" style="width: 100%;height:150px; text-align: left;">
</div>
</div>
</div>
</div>
</section>
</div>
<div class="col-md-3">
<section class="panel">
<div class="panel-body">
<div class="top-stats-panel">
<div class="widget-h">Kendaraan aktif hari ini</div>
<div >
<ol id="totalJenisKendaraanAktif" class="list-group">

</ol>
<div class="daily-sales-info" id="totalKendaraanAktif">

</div>
</div>
</div>
</div>
</section>
</div>
</div>

<div class="row">
<div class="col-md-7">
<!--tonase graph start-->
<section class="panel">
<header class="panel-heading">Tonase Lima TPS terbesar
<!-- <span class="tools pull-right">
<a href="javascript:;" class="fa fa-chevron-down"></a>
<a href="javascript:;" class="fa fa-cog"></a>
<a href="javascript:;" class="fa fa-times"></a>
</span>-->
</header>
<div class="panel-body">
<div id="tonaseLimaHariTPS" class="main-chart">
</div>
</div>
</section>
<!--tonase graph end-->
</div>
<div class="col-sm-5">
<section class="panel">
<header class="panel-heading">
Total Tonase 5 Hari Terakhir
</header>
<div class="panel-body">
<div id="tonaseLimaHariTotal"></div>
</div>
</section>
</div>
</div>

<button type="button" class="btn btn-primary" id="next">Selanjutnya</button>


<div class="collapse">
<div class="row">
<div class="col-md-6">
<section class="panel">
<header class="panel-heading">
Total Tonase Satu Bulan
</header>
<div class="panel-body">
<div id="tonaseSatuBulanTotal"></div>
</div>
</section>
</div>
<div class="col-md-6">
<section class="panel">
<header class="panel-heading">
Total Bahan Bakar Satu Bulan
</header>
<div class="panel-body">
<div id="bahanBakarSatuBulanTotal"></div>
</div>
</section>
</div>
</div>

<div class="row">
<div class="col-md-12">
<section class="panel">
<header class="panel-heading">
Rute Terakhir Seluruh Kendaraan
<!-- <span class="tools pull-right">
<a href="javascript:;" class="fa fa-chevron-down"></a>
<a href="javascript:;" class="fa fa-cog"></a>
<a href="javascript:;" class="fa fa-times"></a>
</span>-->
</header>
<div class="panel-body">
<div class="adv-table">
<table class="display table table-bordered table-striped" id="ruteIndex">
<thead>
<tr>
<th>Nomor Polisi</th>
<th>Nama Supir</th>
<th>Rute Asal</th>
<th>Rute Tujuan</th>
<th class="hidden-phone">Waktu Berangkat</th>
<th class="hidden-phone">Waktu Target</th>
<th>Lapor</th>
</tr>
</thead>
<tbody id="tabelRute">
</tbody>
<tfoot>
<tr>
<th>Nomor Polisi</th>
<th>Nama Supir</th>
<th>Rute Asal</th>
<th>Rute Tujuan</th>
<th class="hidden-phone">Waktu Berangkat</th>
<th class="hidden-phone">Waktu Target</th>
<th>Lapor</th>
</tr>
</tfoot>
</table>
</div>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-md-9">
<section class="panel">
<header class="panel-heading">
Peta Surabaya <strong>(KLIK NOPOL PADA TABEL DI ATAS UNTUK MELIHAT RUTE)</strong>
<!--<span class="tools pull-right">
<a href="javascript:;" class="fa fa-chevron-down"></a>
<a href="javascript:;" class="fa fa-cog"></a>
<a href="javascript:;" class="fa fa-times"></a>
</span>-->
</header>
<div class="panel-body" >
<h3 id="estimasiWaktu"></h3>
<div id="petaSurabaya" style="height: 500px;"></div>
</div>
</section>
</div>
<div class="col-md-3">
<div class="mini-stat clearfix">
<span class="mini-stat-icon pink"><i class="fa fa-tags"></i></span>
<div class="mini-stat-info">
<span id="detailNopol"></span>
Nomor Polisi Kendaraan
</div>
</div>
</div>
<div class="col-md-3">
<div class="mini-stat clearfix">
<span class="mini-stat-icon green"><i class="fa fa-road"></i></span>
<div class="mini-stat-info">
<span id="detailJarak"></span>
Estimasi Jarak Ditempuh
</div>
</div>
</div>
<div class="col-md-3">
<div class="mini-stat clearfix">
<span class="mini-stat-icon tar"><i class="fa fa-truck"></i></span>
<div class="mini-stat-info">
<span id="detailWaktuBerangkat"></span>
Estimasi Waktu Berangkat
</div>
</div>
</div>
<div class="col-md-3">
<div class="mini-stat clearfix">
<span class="mini-stat-icon orange"><i class="fa fa-clock-o"></i></span>
<div class="mini-stat-info">
<span id="detailWaktuSampai"></span>
Estimasi Waktu Sampai
</div>
</div>
</div>
<div id="divDetailWaktuSampaiTPA" class="col-md-3 hidden">
<div class="mini-stat clearfix">
<span class="mini-stat-icon orange"><i class="fa fa-clock-o"></i></span>
<div class="mini-stat-info">
<span id="detailWaktuSampaiTPA"></span>
Estimasi Waktu Sampai TPA
</div>
</div>
</div>
</div>
</div>
</div>

我的JS:

$(document).ready(function(){
$(".btn-primary").click(function(){
$(".collapse").collapse('show');
});
});

$(".btnLoadMonitoring").click(function(){
$(".collapse").collapse('hide');
tanggal = $("#tanggalMonitoring").val();
console.log(tanggal);
updateMonitoring(tanggal);
});

最佳答案

这个问题解决了....

我刚刚添加

$(".collapse").collapse({toggle:false});

喜欢

$(document).ready(function () {
$(".collapse").collapse({toggle:false});
$(".btn-primary").click(function(){
$(".collapse").collapse('show');
});
});

谢谢你回答我的问题

关于javascript - jquery bootstrap 崩溃无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46091695/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com