2016-04-28 11 views
2

ich einen Anker haben einen modal zu öffnen:Add URL-Hash, wenn sie auf Klick Bootstrap-modal Anker

<a href="#delete-{{ $id }}" class="btn btn-danger btn-xs btn-delete btn-fla details" data-toggle="modal" data-target="#remove_property_modal"> 
    <i class="fa fa-trash"></i> 
</a> 

Das Problem ist, dass die URL nicht von http://example.com in http://example.com/#delete-4 verändert.

+0

http://stackoverflow.com/q/34154370/4314952 – d4rty

Antwort

1

ändern url Hash auf show.bs.modal Ereignis von Bootstrap-modal (docs)

$(document).ready(function() { 
    $('.modal').on('show.bs.modal', function (e) { 
     if (typeof (e.relatedTarget) != "undefined") { 
      window.location.hash = $(e.relatedTarget).attr('href'); 
     } 
    }); 
}); 
Verwandte Themen