【问题标题】:close bootstrap js dialog without onclick on wpf关闭引导 js 对话框而不点击 wpf
【发布时间】:2017-11-24 07:31:43
【问题描述】:

我想关闭 js 模态但无需点击

无需点击 我想点击wp​​f中的关闭按钮

我想在 WebBrowser 中点击

没有模式将保持隐藏状态。模态打开但关闭选择而不点击 wpf

JS 模式

    <body>

    <div class="container">
      <h2>Activate Modal with JavaScript</h2>
      <!-- Trigger the modal with a button -->
      <button type="button" class="btn btn-info btn-lg" id="myBtn">Open Modal</button>

      <!-- Modal -->
      <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>

        </div>
      </div>

    </div>

    <script>
    $(document).ready(function(){
        $("#myBtn").click(function(){
            $("#myModal").modal();
        });
    });
    </script>

    </body>
    </html>

WPF

public MainWindow()
{
    InitializeComponent();
    wbBrowser.Navigate(new Uri("http://localhost/AlertWebProject"));    
}

【问题讨论】:

    标签: jquery wpf bootstrap-modal bootstrap-4


    【解决方案1】:

    你可以新建一个js函数

    function CloseModal(){
        $("#myModal").modal('Hide');
    }
    

    在您的网络浏览器中,您可以调用脚本函数。 在 WPF 中使用 webbrowser 调用 js 函数 How to communicate between WPF and JavaScript in a WebBrowser instance?

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-02
    • 2020-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多