Postingan lainnya
Kelas Premium!
Belajar Javascript untuk website
Gunakan kupon "mulaijs" untuk diskon 75 ribu!
Kenapa Modal hashchange tidak muncul
Bagian View.php
<!-- Start Modal -->
<div class="main main-raised">
<div class="container-fluid">
<div class="row" id="modals">
<div class="col-md-12">
<div class="title">
<center><h3>Data Siswa</h3></center>
</div>
<button class="btn btn-primary" data-toggle="modal" data-target="#myModal">
<i class="material-icons">library_books</i> Tambah Data
</button>
</div>
</div>
</div>
</div>
<!-- End Modal -->
<!-- Start Modal Content -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Tambah Data Siswa</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<i class="material-icons">clear</i>
</button>
</div>
<div class="modal-body">
<p>Testing Modal</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-link">Nice Button</button>
<button type="button" class="btn btn-danger btn-link" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
site.js
var path = window.location.pathname;
var host = window.location.hostname;
$(function(){
$(window).hashchange(function(){
var hash = $.param.fragment();
if(hash == 'tambah'){
}
else if(hash == 'edit'){
}
else if(hash == 'hapus'){
}
else if(hash == 'ambil'){
}
else if(hash == 'mass'){
}
});
$(window).trigger('hashchange');
$('#myModal').on('hidden', function(){
window.history.pushState(null,null,path);
});
});
Harusnya di URLnya : localhost/project/web/admin/raport#tambah
tetapi hasil yang saya dapatkan URLnya:localhost/project/web/admin/raport
tolong jelaskan
0
1 Jawaban:
$('#myModal').on('hidden', function(){ window.history.pushState(null,null,path);
script diatas digunakan untuk menyembunyikan hash #tambah
0
Tanggapan
jadi diganti dengan 'show'?