【问题标题】:how to connect bootstrap modal with sigma.bind event如何将引导模式与 sigma.bind 事件连接起来
【发布时间】:2016-04-29 10:13:52
【问题描述】:

我想在单击节点时显示模态,但我不知道如何将数据传递给模态,以及如何显示模态。

我找到的所有示例,在单击按钮后显示模态等,

HTML:

<div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Modal Header</h4>
            </div>
            <div class="modal-body">
                <p>Some text in the modal.</p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
        <script>

        </script>

    </div>
</div>

JS:

<script>
    // Generate graph:
    // Instantiate sigma:
    // binding sima instance to an event
    s.bind('doubleClickNode ', function(e) {
        var id = e.data.node.neo4j_data['ID'];
        $('#MyModal').append('<p class="navbar-text">ID: '+ id +'</p>');
        $("#MyModal").modal();
    });
</script>

【问题讨论】:

    标签: twitter-bootstrap sigma.js linkurious


    【解决方案1】:

    我找到了这个足够好的解决方案

            s.bind('doubleClickNode ', function(e) {
                console.log("node is clicked!");
                var id = e.data.node.neo4j_data['ID'];
                var modal = document.getElementById('myModal');
    
                $('#my_label').html ( id ); // my_label inside modal
                $('#myModal').modal('show')            
    
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-02
      • 2018-04-06
      • 2021-02-23
      相关资源
      最近更新 更多