javascript - Ruby on Rails bootstrap modal -
i'm trying use bootstrap modal ajax, problem when click screen gets darker modal never shows. or there better way of doing this?
measures/index.html.erb
<%= link_to 'show', measure,remote: true, class: 'static-popup-link'%> <div class="modal hide fade" id="mymodal" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">loading...</div>
application.js
$(document).ready(function() { var clickonpopuplink = function(){ $('body').on('click', '.static-popup-link', function(){ $('#mymodal').modal('show'); }); } clickonpopuplink(); });
measures_controllers.rb
def show end
show.js.erb
$('#mymodal').html("<%= j render('/measures/modal')%>");
measures/modal.html.erb
<div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">× </button> <h4 class="modal-title" id="mymodallabel"></h4> </div> <div class="modal-body"> ......... </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> <button type="button" class="btn btn-primary">save changes</button> </div> </div> </div>
removing hide class below mentioned div serve purpose
<div class="modal hide fade" id="mymodal" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false">loading...</div>
Comments
Post a Comment