请看下面的JS小提琴,我试图加载Video URL模态的Iframe中的Twitter Bootstrap's,以及模态标题栏中title attr的标题。请让我知道我如何才能让它工作?
http://jsfiddle.net/52VtD/1745/

<span id="http://player.vimeo.com/video/78360422" title="Introduction to this video" class="btn btn-warning" ><a data-toggle="modal" data-target="#myModal" href="http://player.vimeo.com/video/78360422" target="ifr">1) VIDEO TO LOAD IN IFRAME # 1</a> </span><br><BR>
<span id="http://player.vimeo.com/video/53671222" title="About It" class="btn btn-warning" > 2) VIDEO TO LOAD IN IFRAME # 2 </span>

<!-- Button trigger modal --><br><BR>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Span Title Attr Text Here</h4>
      </div>
      <div class="modal-body">
                                                                 <iframe name="ifr" src='' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

      </div>
          </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

最佳答案

$(document).on("click", "span.btn", function () {
     var title = $(this).prop('title'),
         id = $(this).prop('id');
     $(".modal-title").text(title);
     $(".modal-body").html($("<iframe src=" + id + "></iframe>"));
});

示例:http://jsfiddle.net/52VtD/1766/

10-04 22:19